To set an initial state in a class component, the ________ property is used.

  • constructor
  • defaultState
  • initState
  • initialState
To set an initial state in a class component in React, the constructor property is used. The constructor is where you define the component's initial state by assigning an object to this.state.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *