fetch-in-react Flashcards
1
Q
How can useEffect be used to load data for a component?
A
you can fetch data and set states or update props
2
Q
What browser function can be used to make HTTP requests to a server in React?
A
3
Q
How do you use useEffect to load component data just once when the component mounts?
A
leave the dependency as an empty array
4
Q
How do you use useEffect to load component data every time the data key changes?
A
add that as a dependency