This topic is important to me because these are key components of React, and I want to become great at using it.
https://medium.com/@joshuablankenshipnola/react-component-lifecycle-events-cb77e670a093. https://www.youtube.com/watch?v=IYvD9oBCuJI. https://reactjs.org/docs/state-and-lifecycle.html. https://reactjs.org/docs/handling-events.html. https://reactjs.org/tutorial/tutorial.html. https://react-bootstrap.github.io/. https://getbootstrap.com/docs/5.0/examples/cheatsheet/. https://bootstrapshuffle.com/classes. https://www.netlify.com/.
Lifestyle events are methods you can use on components.
They are called during the lifecycle of a component, and allow you to update the UI and the application states.
The Three Phases are:
Mounting : When an instance of a component is being created and inserted into the DOM.
Life of Lifestyle Events for Mounting:
Constructor
static
getDerivedStateFromProps
render
componentDidMount
UNSAFE_componentWillMount
Updating: Anytime a component is updated or state changes then its rerendered.
List of Lifestyle Events for Updating:
static getDerivedStateFromProps
shouldComponentUpdate
render
getSnapshotBeforeUpdate
componentDidUpdate
UNSAFE_componentWillUpdate
UNSAFE_componentWillReceiveProps
Unmounting : Lastly, when the a component is being removed from the DOM.
The only lifecycle event is:
componentWillUnmount
The Constructor for a React component is called before it is mounted.
If the component is a subclass you should call super(props). or props will be undefined.
Constructors can be used to assign state or to bind event handle methods to an instance.
Render() is the only required method in a class component.a