0% found this document useful (0 votes)
70 views1 page

Understanding ComponentDidMount

This document outlines the lifecycle of React components. The constructor and componentWillMount methods are for setting up initial state without side effects. The render method prepares and structures JSX code and renders child components. The componentDidMount method is for causing side effects after initial render without updating state.

Uploaded by

Radu Miruna
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views1 page

Understanding ComponentDidMount

This document outlines the lifecycle of React components. The constructor and componentWillMount methods are for setting up initial state without side effects. The render method prepares and structures JSX code and renders child components. The componentDidMount method is for causing side effects after initial render without updating state.

Uploaded by

Radu Miruna
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Component Lifecycle - Creation

Call super(props)
Default ES6 class
constructor(props) DO: Set up State
Feature
DON‘T: Cause Side-Effects

DO: Update State, last-


Exists for Historic
componentWillMount() minute Optimization
Reasons
DON‘T: Cause Side-Effects

Prepare & Structure your


render()
JSX Code

Render Child Components

DO: Cause Side-Effects


componentDidMount() DON‘T: Update State
(triggers re-render)

You might also like