I have a functional component in react native which is receiving its parent state as props.
const PainLevel = ({painLevelColor = 'green', setPainLevelColor}) => {...}
parent:
const BodyParts = () => {
const [side, setSide] = useState('Front');
const [painLevelColor, setPainLevelColor] = useState('#43BA08');
return(
{...}
<PainLevel
painLevelColor={painLevelColor}
setPainLevelColor={setPainLevelColor}
/>
);
};
It's working fine when both are in the same file but when I move my child component into my components folder it's throwing this error TypeError: undefined is not an object (evaluating '_ref.painLevelColor')
I have not set the base of the project and have no idea what is causing this
any Idea?