title: How do I share state between react native screens?
body: <p>I'm trying to build an app with react native and react navigation, such that changing something in one screen will also change it in the other.</p>
  
  <p>So far, the only way I have found to be able to sync data between the two screens, is to use buttons with <code>onPress={() =&gt; navigate('OtherScreen', this.state)}</code>. This has two problems. Firstly that it only works where I explicitly call navigate - when I swipe to change screen, it won't transfer the data. But mostly, this just seems contrary to the react philosophy, that data should be pulled from the model by the render call, rather than one render method pushing data into another component.</p>
  
  <p>This has completely stumped me. My current "solution" is to write my entire app in a single file, so that everything is in the same scope and I can use a global variable to store the global state.</p>
  
  <p>I cannot possible be the first person to have this problem, and I find it hard to imagine that react-native would not have <em>any</em> built-in method for defining an application-wide data store.</p>
  
  <p>Is there a standard pattern for sharing data globally in react-native?</p>
  
  <p>How can I sync data between two screens?</p>