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.
You can simply do projectData[VARIABLE_FROM_PROPS]["projectDetails"]
or
projectData[VARIABLE_FROM_PROPS].projectDetails