React Hook: useEffect

Learn how to perform side effects in React functional components using the useEffect hook.

useEffect

The useEffect hook The useEffect hook is a user-defined function in a component that React calls after rendering. The useEffect hook is a functional component equivalent of the class-based component methods of componentDidMount, componentDidUpdate, and componentWillUnmount combined. The React useEffect hook allows us to perform side effects in a React component. Examples of side effects of React components are data fetching, manual DOM manipulation, subscription, and so on.

Let’s see an example below:

Get hands-on with 1200+ tech skills courses.