Term | |
---|---|
State Hook | the State of a component is an object that holds some information that may change over the lifetime of the component.and Hook that allows you to have state variables in functional components , it takes the initial state as an argument and returns an array of two entries. |
Mounting and Un-Mounting | Mounting is the process of outputting the virtual representation of a component into the final UI representation (e.g. DOM or Native Components). & Un-Mounting: This method is called just before the component gets destroyed. Any clean up statements should be executed inside this method. |
” Placing useEffect inside the component lets us access the count state variable (or any props) right from the effect. We don’t need a special API to read it — it’s already in the function scope”.
“React performs the cleanup when the component unmounts. However, effects run for every render and not just once. This is why React also cleans up effects from the previous render before running the effects next time”.