Fetch-In-React Flashcards
1
Q
How can useEffect be used to load data for a component?
A
- update our useEffect to pass a prop called id to the URL,
- use a dependency array, so that we only run this useEffect when id changes, and then.
- use the useState hook to store our data so we can display it later.