Slide 25
Slide 25 text
function useGetData() {
const [state, setState] = useState();
const [otherState, setOtherState] = useState();
useEffect(() => {
fetchData().then(setState);
}, []);
useEffect(() => {
fetchOtherData(state.id).then(setOtherState);
}, [state.id]);
return otherState;
}
function App() {
const data = useGetData();
return ;
}