I wonder if it make sense (or possible) to use useEffect
inside a child component to load data only when the child component is included in the parent compnent.
Inside the child component I have the following code:
useEffect(() => {
if (props.rubricItems.length < 1)
props.fetchRubricsData(courseId);
}, [])
But this does not trigger any call.
Do you suggest that I make fetch all data in the parent component? I did not want to do to avoid loading data that is not used. Any suggestions?