title: Global variable for react
body: <p>I don't know, how to use a global variable.</p>
  <p>I want to make &quot;this.props.topic.text&quot; a global variable to use it on an other app of my project. How can I do that?</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>export default class Topic extends Component {
  
    deleteThisTopic() {
      Topics.remove(this.props.topic._id);
    }
  
    test() {
    
    }
    render() {
      return (
  
        &lt;Router&gt;
      &lt;div&gt;
        &lt;ul&gt;
          &lt;Link to="/sub"&gt;&lt;li onClick={this.test.bind(this)}&gt;{this.props.topic.text}  ARN:  {this.props.topic.arn}&lt;/li&gt;&lt;/Link&gt;
          &lt;Link to="/log"&gt;&lt;button onClick={this.test.bind(this)}&gt;S'inscrire&lt;/button&gt;&lt;/Link&gt;
          &lt;Link to="/"&gt;&lt;button &gt;Cacher&lt;/button&gt;&lt;/Link&gt;
          &lt;button onClick={this.deleteThisTopic.bind(this)}&gt;Suprimer&lt;/button&gt;
        &lt;/ul&gt;
  
        &lt;hr/&gt;
        &lt;Route exact path="/log" component={AppInscription}/&gt;
        &lt;Route exact path="/sub" component={AppSub}/&gt;
  
  
      &lt;/div&gt;
    &lt;/Router&gt;
    );
    }
  }
  
  Topic.propTypes = {
  
    topic: PropTypes.object.isRequired,
  };</code></pre>
  </div>
  </div>
  </p>