title: Where to declare variable in react js
body: <p>I am trying to declare a variable in a react-js class. The variable should be accessible in different functions. This is my code</p>
  <pre><code>class MyContainer extends Component {
      constructor(props) {
          super(props);
          this.testVariable= &quot;this is a test&quot;;  // I declare the variable here
      }
      onMove() {
          console.log(this.testVariable); //I try to access it here
      }
  }
  </code></pre>
  <p>On onMove, the value of <code>this.testVariable</code> is undefined. I Know that I could put the value on the state but I don't want to do it because each time the value changes, <code>render()</code> will be called which is not necessary. I am new to react, did I make something wrong?</p>