React-native-web: routing

Created on 26 Mar 2018  路  4Comments  路  Source: necolas/react-native-web

Feature request

simple working routing example

Most helpful comment

It is possible to import from react-router-dom if it's running on the web and import from react-router-native if it is on mobile.

I made a simple example here: https://github.com/edupooch/simple-crna-routing

All 4 comments

Routing is not part of React Native or React DOM, so you can use the structure of examples found in projects like React Router and React Navigation (which is working on adding web support IIRC)

react-router-native is an ES module (https://github.com/ReactTraining/react-router/issues/6115), meaning it is incompatible with browsers when compiled for my web app (which leads to a blank screen and a SyntaxError in the console).

Alternatively, will react-router-dom paired with react-native-web work for mobile devices?

It is possible to import from react-router-dom if it's running on the web and import from react-router-native if it is on mobile.

I made a simple example here: https://github.com/edupooch/simple-crna-routing

@edupooch Nice!

Any example with a frontend directory inside a backend framework (all in one repo, that defaults to web)?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SamyPesse picture SamyPesse  路  3Comments

necolas picture necolas  路  3Comments

tgh picture tgh  路  3Comments

iksent picture iksent  路  3Comments

rohanprabhu picture rohanprabhu  路  3Comments