Skip to main content

What is the use of useEffect React Hooks?

Published 1 min readMarkdown
Part of seriesReact
What is the use of useEffect React Hooks?

The Effect Hook lets you perform side effects in function components. Data fetching, setting up a subscription, and manually changing the DOM in React components are all examples of side effects.

Effects Without Cleanup Sometimes, we want to run some additional code after React has updated the DOM. Network requests, manual DOM mutations, and logging are common examples of effects that don’t require a cleanup.

Effects with Cleanup We might want to set up a subscription to some external data source. In that case, it is important to clean up so that we don’t introduce a memory leak!

Sources:

Using the Effect Hook –. (n.d.). React. https://reactjs.org/docs/hooks-effect.html

About the author

  • Full Stack Developer with a passion for building web applications. PHP, Node.js, Laravel, MySQL, MongoDB. Love collaborating & making a difference

No comments yet. Be the first to comment.

More from this blog