How to pass a variable inside a component in react
<p>I have the following component: </p>

<pre><code>const Rec = React.createClass({
    mixins: [React.addons.PureRenderMixin],
    renderText() {
        if (hidden) {
            req_link = &lt;Link to={`/rec/edit`} style={st}&gt;Request link&lt;/Link&gt;
        }
        else {
            request_link = null   
        }

        return (
             &lt;div&gt; {request_link} &lt;/div&gt;
        );
    },

    fields() {
        ....
        if (fieldID == "hidden") {
              var hidden = true;
        } else {
              var hidden = false;
        }
        return (
              &lt;div&gt; other stuff....  &lt;/div&gt;
        );
   },
});
</code></pre>

<p><code>renderText()</code> should show a link if the value of <code>hidden</code> is true, and value for this variable can only be set in <code>fields()</code>. So how can I pass <code>hidden</code> from <code>fields()</code> to <code>renderText()</code>?</p>