title: setState outside Component
body: <p>Im having trouble with the following code:</p>
  
  <p>My compnent:</p>
  
  <pre><code>class Landing extends Component {
  
    state = {
      loginMethod: '',
      tournamentCode: -1,
    }
  }
  </code></pre>
  
  <p>My Const:</p>
  
  <pre><code>const Code = () =&gt; (
    &lt;div className="" style={{marginTop: 20}}&gt;
       &lt;input
        className=""
        style={{lineHeight: 1, height: 30, border:0, paddingLeft: 5}}
        placeholder="Tournament Code"
        onChange={e =&gt; this.setState({tournamentCode: e.target.value})} /&gt;
      &lt;Link to="/App"&gt;
        &lt;button className="" style={{marginLeft: 10, border: 0, outline:        
            'none', background: '#efefef', height: 30, width: 80}}&gt; Enter &lt;/button&gt;
      &lt;/Link&gt;
    &lt;/div&gt;
  )
  </code></pre>
  
  <p>Both of there are in the same <code>Landing.js</code> file.</p>
  
  <p>I know my problem is that i try to do <code>this.setState</code> outside the Landing class.
  Are there any solutions for this problem? Or is there a better way i should program this?</p>
  
  <p>I've also read some things about redux and contexts in react. Which of these is my best way to go? Or are there more easy solutions?</p>