title: DevSettings.reload() for logout in React Native
body: <h2>The Problem</h2>
  <p>I am migrating the logout functionality of my hybrid app from native to react native.</p>
  <p>Requirements:</p>
  <ul>
  <li>It works in production and on a device</li>
  <li>It navigates to the root screen of the app (login screen)</li>
  <li>It clears the redux store</li>
  <li>[nice to have] It cancels any in-flight requests</li>
  </ul>
  <p>Initially, we planned to do something like this: <a href="https://stackoverflow.com/a/35641992/2423416">how-to-reset-the-state-of-a-redux-store</a></p>
  <h2>The Idea</h2>
  <p>As of React Native 0.62.0, we now have access to the DevSettings module. DevSettings has a native bridge that can <a href="https://reactnative.dev/docs/devsettings#reload" rel="nofollow noreferrer">reload</a> the react-native environment. But are DevSettings really only for development environments?</p>
  <blockquote>
  <p>Export the DevSettings module, add addMenuItem method (cc068b0551 by
  @janicduplessis)</p>
  </blockquote>
  <h2>The Question</h2>
  <ol>
  <li>What are the tradeoffs for using reload vs logging out with a redux action?</li>
  <li>Should I use reload in a production app?</li>
  </ol>
  <h2>Edit: The Answer</h2>
  <ol>
  <li>Reload is disallowed in prod (<a href="https://github.com/facebook/react-native/blob/0b9ea60b4fee8cacc36e7160e31b91fc114dbc0d/Libraries/Utilities/DevSettings.js#L59-L65" rel="nofollow noreferrer">code</a>)</li>
  <li><a href="https://www.npmjs.com/package/react-native-restart" rel="nofollow noreferrer">react-native-restart</a> worked great for my use case.</li>
  </ol>