- What's the main difference between navigation in React web apps and React Native apps?
- There is no meaningful difference between web and mobile applications in terms of navigation.
- Web applications rely on URLs as the central concept for moving around. Native apps have no such concept, so it's up to the developer and the navigation libs they use to manage their screens.
- Native application code uses URLs the same way as with web applications, but these just aren't exposed to the user.
- What function should be used to navigate to a new screen?
- Screen components are passed a navigation property. You should use navigation.navigate() to move to another screen.
- The screen component automatically has navigation methods added to it.
- There's a global navigation object that has navigation methods that you can use.
- Does react-navigation handle back button functionality for you?
- Yes. Including the built-in back button on Android systems.
- No, you have to implement all back button behavior yourself.
- How do you pass data to screens?
- You can pass a plain object as the second argument to navigation.navigate(). The properties are then accessible to the screen via navigation.getParam().
- You have to re-render the screen component, passing it parameters that you get as properties from navigation.
- You don't pass data to screens. Setting application level state is the only way to get data into screen components.