/example-react-native-redux

react native redux counter example

Primary LanguageObjective-C

React Native 0.10.1 and Redux 2.0.0 Example

Redux is amazing and combine it with React-Native makes the whole experience more enjoyable. ** However ** there is one tiny thing you have to do. You have to fork react-native and apply 2 patches.

First Babel in React_Native needs to be patch in order for us to use some features such as Decorator and module. In order to do that you have to patch packager/packager.js. This patch lets babel reads configuration from .babelrc file.

Second, This patch is optional but highly recommended, lets you use import with multiple line. As an example,

instead of this,

import React, { Component, View, Text, ScrollView } from 'react-native'

you can do this with this patch:

import React, {
  Component,
  View,
  Text,
  ScrollView
} from 'react-native'

which makes it alot easer to read.

So for doing that, you have to patch packager/react-packager/src/DependencyResolver/replacePatterns.js import regular expression to include enter char.

I have already using my fork in production which includes latest stable react-native 0.10 with these two patches. In this example, I have used my fork.

Enjoy and happy reducing :P