I began to study the reactor and faced a situation that I don’t understand in principle, but I really want to understand: how is the "listening" of global variables organized in the react, which are available to all classes within a single application or script?
I will give an example in pseudocode:
var a = false; var globalVariable = function(e) { a = e.target.value; } var ExampleClassA = React.createClass({ getInitialState: functuion () { return { globalAccess: false } } render: function() { return ( <div> <input type='checkbox' onChange={globalVariable.bind(this)}/> </div> ) } }) var ExampleClassB = React.createClass({ render: function() { return ( <span>{то, что поможет как-нибудь получить значение a}</span> ) } })
Of course, there may be a lot of mistakes, but the picture is clear in principle.