Skip to content

ProgrammingHero1/react-functional-component-lifecycle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React LifeCycle Methods Diagram

functional component lifecycle


React functional component lifecycle methods

1. Mounting
    - useState and useEffect are called during the mounting phase.
    - useState sets the initial state of the component.
    - useEffect is used to perform any side effects after the component has mounted.

2. Updating
    - Whenever the component state or props change, the component re-renders.
    - During the updating phase, useEffect is called again.
    - Any changes to the state or props can be handled here.

3. Unmounting
    - When the component is removed from the DOM, useEffect can be used for cleanup operations.
    - The cleanup function is called right before the component is unmounted.

**Note: The lifecycle diagram above applies to functional components that use hooks. Without hooks, the lifecycle is simpler and does not have a separate phase for useEffect.**

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published