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

189
Views
How to dynamically access JSON data?

I have a React Child component that looks like this:

const SingleProject =(props)=>{
    let data = projectData.VARIABLE_FROM_PROPS.projectDetails;
    let asideData = projectData.VARIABLE_FROM_PROPS.projectSideBar;

    useEffect(() => {
        console.log(props);
    }, []);
    return (<></>);

How can I use the value in props: props.pathname to get the projectDetails data.

Basically, if props.pathname is golly then I need to be able to get the data from projectData.golly.projectDetails.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can simply do projectData[VARIABLE_FROM_PROPS]["projectDetails"]

or

projectData[VARIABLE_FROM_PROPS].projectDetails

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!