Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

155
Views
ReactJS how to pass child component title from parent component

I am using a slick carousel component to display products for different pages, so I need to set its title from parent component: something like <Component title="Products" />

Here is the basic structure of my jsx files, can we do it with a simple method like below?

Parent.jsx:

const Parent = () => {
  return (
    <Component title="Products" />
  );
}

export default Parent;

Component.jsx:

const Component = () => {
  return (
    <h3>
      {title}
    </h3>
  );
}

export default Component;
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

You can pass data from a parent Component to a Child via the props:

const Parent = () => {
  return (
    <Component title="Products" />
  );
}

export default Parent;

Component.jsx:

const Component = ( props ) => {
  return (
    <h3>
      {props.title}
    </h3>
  );
}

export default Component;
about 4 years ago · Juan Pablo Isaza Report

0

You need to access the title parameter like this

Destructured parameter

const Component = ({title}) => {
  return (
    <h3>
      {title}
    </h3>
  );
}

export default Component;

or like this

props parameter

const Component = (props) => {
  return (
    <h3>
      {props.title}
    </h3>
  );
}

export default Component;
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!