How to set variable in render with reactjs?
<p>I have a reactjs rendermethod and I am trying to set a variable through a function, it looks like this(you guessed it , does  not work):</p>

<pre><code>render() {
        let myVariable=''

        //this function changes/sets myVariable
        this.changeMyVariable()

        return (
            &lt;div&gt;{myVariable}&lt;/div&gt;
        );
}
</code></pre>

<p>How can I set a variable that is used in my render through another function , something like the example above. I also tried to use a statevariable but the changeVariable function runs twice.</p>