Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 381ba36

Browse files
author
Ar11rA
committed
Fix typo
1 parent 066d51e commit 381ba36

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

‎10-navigation/10.2-integrating-with-redux-store.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,26 @@ Run `npm install react-navigation-redux-helpers` or `yarn add react-navigation-r
4242
const homeNavAction = router.getActionForPathAndParams('home');
4343
const initialNavState = router.getStateForAction(homeNavAction);
4444

45-
const navReducer = (state = initialNavState, action) => {
45+
const nav = (state = initialNavState, action) => {
4646
const nextState = router.getStateForAction(action, state);
4747
return nextState || state;
48-
};
48+
};
49+
50+
export default combineReducers({
51+
test,
52+
nav
53+
});
4954
```
5055

51-
Now let's go through the code
56+
Now let's go through the code:
5257

5358
- `router.getActionForPathAndParams`: This function receives the key defined for a route in Navigator and params and returns an action which is needed to update the navigation state. In redux language, we need to call this action to navigate to a route.
5459

5560
Output of this statement: `Object {type: "Navigation/NAVIGATE", routeName: "home", action: Object}`
5661

5762
This is the action that we get for the path 'home'. This becomes the initial route of our navigator.
5863

59-
- `router.getStateForAction(homeNavAction)`: : The above step gives us the action for navigating to the initial route, now we have to update the state of the Navigator to actually navigate to the route. So we pass the action and the current state of the navigator to getStateForAction and it returns the new updated state.
64+
- `router.getStateForAction(homeNavAction)`: The above step gives us the action for navigating to the initial route, now we have to update the state of the Navigator to actually navigate to the route. So we pass the action and the current state of the navigator to getStateForAction and it returns the new updated state.
6065

6166
Output of this statement:
6267

@@ -76,7 +81,7 @@ Run `npm install react-navigation-redux-helpers` or `yarn add react-navigation-r
7681
```
7782

7883

79-
2. Add React Navigation Redux Middleware to store
84+
2. Add React Navigation Redux Middleware to store:
8085

8186
```js
8287
import React, { Component } from 'react';
@@ -114,7 +119,9 @@ import { StackNavigator, addNavigationHelpers } from 'react-navigation';
114119
import { createReduxBoundAddListener } from 'react-navigation-redux-helpers';
115120
import PropTypes from 'prop-types';
116121

117-
import AuthRoutes from './auth.routes';
122+
//example routes
123+
import AuthRoutes from './auth.routes';
124+
//example component
118125
import Home from '../Components/Home';
119126

120127
export const Router = StackNavigator({

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /