9

Need to reuse the react-navigation code from mobile to react-native-web. But I could not able to get it work in web.

enter image description here

Should we need to use react-router for web separately?

How can we configure navigation commonly for both platform? I would love to see an example of this! It would be super helpful. Thank you!!

Balasubramanian
  • 4,342
  • 3
  • 28
  • 51

2 Answers2

2

Maybe you can check this implementation

Using React Native, React Native Web and React Navigation in a single project

jcvalerio
  • 111
  • 4
1

The above answers are quite old now I'd say as react-navigation has upgraded itself quite a bit since then.

react-navigation v4 has intensive support for react native web, now you don't need to maintain two separate navigation objects for web and app.

This blog explains it in detail. https://codersera.com/blog/how-to-do-navigation-in-react-native-web-in-2020/