Skip to content

Commit

Permalink
Merge pull request #179 from wgao19/docs/react-redux-push-example
Browse files Browse the repository at this point in the history
Add example for push state using react-redux with connect
  • Loading branch information
supasate committed Nov 11, 2018
2 parents 26f681f + d8d4d79 commit 4a7a879
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions FAQ.md
Expand Up @@ -16,6 +16,22 @@ import { push } from 'connected-react-router'
store.dispatch(push('/path/to/somewhere'))
```

#### with react-redux
```js
import { push } from 'connected-react-router'

// in component render:
<div onClick={() => {

/** do something before redirection */
props.push('/home');

}}>login</div>

// connect the action:
export default connect(null, { push })(Component);
```

#### in redux thunk
```js
import { push } from 'connected-react-router'
Expand Down

0 comments on commit 4a7a879

Please sign in to comment.