How we save 1M hours of development using React Navigation

Sibelius Seraphini
2 min readFeb 21, 2019

React Navigation is the facto solution when you talk about navigation in React Native app. React Navigation 3.x has many improvements in performance and code that your apps just benefits from it.

When doing development on web, when you reload a page you go back to the same page you were at, because the browser has the url, and url is the state of your navigation on web.

However on react native app we don't have an url to save our navigation state, and every time you reload your app, you going to start at the initial route of your navigation, this takes you a lot of time because you need to go back to the navigation state you were at. You were just waiting your time navigating back at every reload. So how can we fix this?

Navigation State Persistence to rescue

React Navigation has an experimental feature that let you persist your navigation state to AsyncStorage, so every time you reload your app you are going to be in the same screen you were at, isn't beautiful?

You can read more here in the docs https://reactnavigation.org/docs/en/state-persistence.html

Adding to your React Native App (latest version)

Adding to your React Native App (old version)

You just need 2 lines to make this work in your React Native App

This 2 lines will save many hours of development, kudos to reactnavigation team

Newsletter

Subscribe to my newsletter for new content https://sibelius.substack.com/

--

--