Fetch in React Flashcards
1
Q
How can useEffect be used to load data for a component?
A
After the page has been rendered you can add data after the fact
2
Q
What browser function can be used to make HTTP requests to a server in React?
A
fetch
3
Q
How do you use useEffect to load component data just once when the component mounts?
A
put an empty dependency
4
Q
How do you use useEffect to load component data every time the data key changes?
A
[the data key]
5
Q
In a large-scale production app, what are some better alternatives for loading and managing backend data?
A
React Query, Vercel SWR