React Hook: useEffect
Learn how to perform side effects in React functional components using the useEffect hook.
We'll cover the following...
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:
Access this course and 1400+ top-rated courses and projects.