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

165
Views
React unable to read props.title (undefined) despite passing props as usual

Error 1

I am getting this error above but I am passing props to the component; I can't figure out what's the issue here. I have been using React for a while but I was using classes, and I wanted to try using function components too. They should be technically the same however as far as I understand, just that you don't need to use this.props and you can just access props.

I am using the components on the 'Socials' page, using the Routing method below: (I get this error on "/", where the component isn't supposed to load. I'm not sure if this is causing the error, because I have not encountered this type of issue.)

        <div className = "appBody">
    <Router basename={process.env.PUBLIC_URL}>
      <Routes>
        <Route path="/" element={Home} exact/>
        <Route path="" element={Home} exact/>
        <Route path="/About" element={Home}/>
        <Route path="/Games" element={Home} />
        <Route path="/Software" element={Home} />
        <Route path="/Art" element={Home} />
        <Route path="/Writing" element={Home} />
        <Route path="/Socials" element={Socials} />
      </Routes>
    </Router>
    </div>

Here is the component I am using:

    const SocialCard = (props) => {

    console.log(props.title);

  return (
    <Card sx={{ minWidth: 275 }}>
      <CardContent>
        {/*Add icon here later*/}
        <Typography sx={{ fontSize: 16 }} color="text.secondary" gutterBottom>
          {props.title}
        </Typography>
        <Typography variant="h5" component="div">
          {props.handle}
        </Typography>
      </CardContent>
      {props.hasLink == true &&  
      <CardActions>
        <Button size="small" onClick = {() => openURL(props.url)}>View</Button>
      </CardActions>}
    </Card>
  );
}

export default SocialCard();

Here I have passed the props to the component as an example.

 <Grid item xs={5}>
        <SocialCard title = {'email'} handle = {'example@gmail.com'} hasLink = {false}/>
      </Grid>
 <Grid item xs={5}>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Instead of export default SocialCard() I should have done it without the brackets.

Final component code:

const SocialCard = (props) => {

    console.log(props.title);

  return (
    <Card sx={{ minWidth: 275 }}>
      <CardContent>
        {/*Add icon here later*/}
        <Typography sx={{ fontSize: 16 }} color="text.secondary" gutterBottom>
          {props.title}
        </Typography>
        <Typography variant="h5" component="div">
          {props.handle}
        </Typography>
      </CardContent>
      {props.hasLink == true &&  
      <CardActions>
        <Button size="small" onClick = {() => openURL(props.url)}>View</Button>
      </CardActions>}
    </Card>
  );
}

export default SocialCard;
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!