React JS - componentDidMount Life Cycle Method

 












The componentDidMount() method is called after render(), it means after the component is rendered.

It is called in Mounting phase, so it will DOES NOT gets called when we update state.

After HTML is rendered, then this componentDidMount() method is called. This function is called only one time after component is rendered.

componentDidMount() method is mostly used in API calling.













Output :






Interview Question

  • Should we update state inside render() method?
    No



Comments