V
V
Vladimir2017-08-18 12:53:33
Sessions
Vladimir, 2017-08-18 12:53:33

SessionStorage in React/Redux?

How to store checkbox state in sessionStorage in React/Redux?
Input example:

<input
     checked={localCheck}
     className="local_checkBox"
     type="checkbox"
     onChange={() => this.clickOnCheckBoxD(params)}/>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2017-08-18
@vnam92

inside some function where you plan to store:
in your input:

<input
     checked={window.sessionStorage.getItem('localCheck') ? true : false } // или 'checked' : false не помню точно,
     className="local_checkBox"
     type="checkbox"
     onChange={() => this.clickOnCheckBoxD(params)}/>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question