Effects Flashcards
When is a component “mounted” to the DOM?
When the page is loaded after the page is loaded
What is a React Effect?
tell React that your component needs to do something after render
When should you use an Effect and when should you not use an Effect?
run something after a component that is already setup
When do Effects run?
Effects are always run after rendering
What function is used to declare an Effect?
useEffect()
What are Effect dependencies and how do you declare them?
(setup, dependencies) data or functions that can be passed has to be declared inside of the function
Why would you want to clean up from an Effect?
to keep the information from being scrambled, just incase something goes wrong
How do you clean up from an Effect?
return () =>
ignore true
When does the cleanup function run?