Skip to content

Commit

Permalink
Add example for push state using react-redux with connect
Browse files Browse the repository at this point in the history
  • Loading branch information
wgao19 committed Nov 9, 2018
1 parent 26f681f commit d8d4d79
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 d8d4d79

Please sign in to comment.