Global variable for react
It is a terrible idea, but probably the best/easiest way to use a global variable in React is to put it on the window
. In a component you could do something like window.topicText="some text"
and then access it via window.topicText
everywhere else.
Ideally, if you have data, and in your case likely state, that you need to persist from component to component, you should look into something like Redux or Flux. I prefer Redux.