- Hooks are a new addition to React 16.8.
- They let you use state and other React features without writing a class.
- What does useEffect do? By using this Hook, you tell React that your component needs to do something after render.
- React will remember the function you passed (we’ll refer to it as our “effect”), and call it later after performing the DOM updates.
- Hooks only works in the functional components. so if you want to use useEffect or any other hook you have to use functional components.
- use effect keeps calling itself if you specifically do not specify an empty array at the end of the useEffect.
Eg:
useEffect( () => {
}, []); // empty array specified
0 comments:
Post a Comment