title: I am confused with the const keyword in react
body: <p>I have code that passes data through a react component from a form to a backend. The backend processes it and sends a response. However I am confused with the const keyword, I am seeing in the code. </p>
  
  <pre><code>axios{
    .post('/api/users/register', newUser)
    .then(res =&gt; console.log(res.data))
    .catch(err =&gt; this.setState({ errors: err.response.data }));
  </code></pre>
  
  <p>}</p>
  
  <pre><code>render() {
      const { errors } = this.state;
       &lt;div className="form-group"&gt;
                &lt;input
                  type="text"
                  className={classnames('form-control form-control-lg', {
                    'is-invalid': errors.name
                  })}
                  placeholder="Name"
                  name="name"
                  value={this.state.name}
                  onChange={this.onChange}
        /&gt;
  </code></pre>
  
  <p>You can assume that the code works. However, why is <code>const {errors}</code> defined like this, and how come it can access the errors list from the backend <code>is-invalid': errors.name</code>.</p>
  
  <p>Thank you.</p>