React Native & Web Redux
Native and Web React + Redux application with the same code
This repo shows how to implement an application that uses Redux + React and other related dependencys sharing almost the same exact code. It was inspired by https://github.com/benoitvallon/react-native-nw-react-calculator/.
Instructions:
- Clone
npm install
- You can build the iOS version by running
npm run start
, don't close this process. - Then edit the file
/node_modules/react-native/packager/react-native-xcode.sh
, addapp
to the--entry-file
option, like this:--entry-file app/index.ios.js \
. I couldn't found a better solution for this, if anybody have a better solution, please let me know. - Open
/ios/rnwcounter.xcodeproj
in XCode, hit the Run button, this will install the app in the Simulator, also it will automatically connects to the Packager bundler executed in step 3. - You can build the Web version by running
npm run dev
. This will watch for changes in the files and re build the bundle. - Since I want to keep this small you may need to run a HTTP Server in the root of the project, you can use https://github.com/indexzero/http-server#readme for that.
Web version
iOS version
Now you can edit any file and see the change on the Simulator and the Browser.