I have a Filter component that stores values ​​of various inputs in state. I want to substitute these values ​​in state from localStorage when reloading the page.

Can I do this in the constructor?

constructor(props) { super(props); this.state = { myInput: localStorage.getItem('storedInput') }; } 
  • 2
    Yes you can. This is no problem - inferusvv

0