简体   繁体   中英

How to initialise Redux store in react native with a StackNavigator?

I am creating a react-native app with react-navigation.

Now I ant to implement Redux in my app but I don't know how this works exactly. I created my stacknavigator like this:

const MainNavigator = createStackNavigator({Start: {screen: Start}});

Then I needed the documentation says asks to use createAppContainer(MainNavigator) and AppRegistry.registerComponent()

How to achieve this?

This is a solution:

export default class App extends React.Component {
    render() {
        return (
            <Provider store={store}>
                <MainNavigator />
            </Provider>
        );
    }
}

AppRegistry.registerComponent(appName, () => App);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM