title: Where token should be kept in a front end (reactjs)
body: <p>Hello I am wondering is it a good practice to keep the token in the local storage in react js because I read this article <a href="https://dev.to/rdegges/please-stop-using-local-storage-1i04" rel="nofollow noreferrer">https://dev.to/rdegges/please-stop-using-local-storage-1i04</a> and there they say it is not good to use local storage for sensitive data. Also I am coding a API with a security and session for first time and I will be glad if someone explain me how things must be done right - if there are some resources to read etc. And if it is OK to use token with local storage how this must be done ? how is it saved I saw there are questions asked for saving into (ls) but i can't done this in my request only before that or after that should I use a state variable ? Thanks in advance for any help.</p>
  
  <pre><code>onSubmit = e =&gt; {
  
      e.preventDefault();
      fetch(  `/myresource/customer/${this.state.query}/${this.state.password}`)
          .then(res =&gt; res.json())
          .then((result) =&gt; {
                  console.log(result);
                  this.setState({
                      user: result,
                      password: result
                      localStorage.setItem('token', '');  &lt;-- Here is not legal to set the token value where should it be saved.
                  }
              );
           }
       )
  
       this.setState( { welcomeMsg: 'Hello, ' } );
  }
  </code></pre>