4

I want to create a React web app that may or may not become a native app, and for that I'd like to develop it using React Native for Web. However, I'm not sure what is the best course of action, to keep the native targets a realistic possibility:

  • Do I use react-native init, then add the web aspects on top of it?
  • Do I use create-react-native-app and do the same?
  • Do I use create a webpack based react-native-for-web app and then add ios or android specific features?
Pablo Barría Urenda
  • 5,703
  • 5
  • 20
  • 32

2 Answers2

4

Another option is to use create-react-native-web-app https://www.npmjs.com/package/create-react-native-web-app

$ npm i -g create-react-native-web-app
$ create-react-native-web-app myApp
$ cd myApp
$ npm run web
orYoffe
  • 71
  • 1
  • 5
  • you can read about it here: https://medium.com/@Or_yoffe/start-writing-react-native-for-web-with-react-native-web-%EF%B8%8F-a000d712a37b – orYoffe Dec 28 '18 at 14:29
3

I've been researching this process for the past week. Here are some options I found that might work for you.

Option 1

There is the react-native-web module which basically allows you to simply code in react-native with web polyfills.

Repo here: https://github.com/necolas/react-native-web

Option 2

There's also a template called re-start you can use which can set you up with a startpoint that will allow you to code in react-native and build Android, iOS, Web, Windows[UWP] and Electron[macOS, Ubuntu, Windows] apps. Repo here: https://github.com/react-everywhere/re-start

Option 3

If you don't want to use the polyfill option, I actually am working on a build that just simply merges react-native and create-react-app but you have to separate the logic between the 2 platforms yourself.

Repo here: https://github.com/ReyHaynes/react-redux-web-native

ReyHaynes
  • 2,932
  • 1
  • 15
  • 22
  • Thanks @ReyHaynes . I'm pretty sold on `react-native-web`. My question was more about what is the best way to go about setting up the initial project, if you create a web project and add native, or a native project and add web, etc. – Pablo Barría Urenda Nov 08 '17 at 15:22