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.
Loading...
Related Quiz
- In a React application that uses Web Workers, a user reports that a specific feature is causing the app to freeze. What might be a potential cause?
- What are styled components?
- When should you use a function inside setState or useState instead of directly setting the state?
- In React-Redux, the hook that allows you to extract data from the Redux store is ________.
- What is the difference between Shadow DOM and Virtual DOM?