DEV Community

Discussion on: React Interview Questions 🔥

Collapse
 
sobingt profile image
Sobin George Thomas • Edited

@adamaslan Well, you should not call setState() in the constructor(). Instead, if your component needs to use local state, assign the initial state to this.state directly in the constructor.
src: reactjs.org/docs/react-component.h...

React Screenshot

Some comments have been hidden by the post's author - find out more