From d8d4d79e0ab73c9f55b47cf4f8c224324570422f Mon Sep 17 00:00:00 2001 From: Wei Gao Date: Fri, 9 Nov 2018 13:05:29 +0800 Subject: [PATCH] Add example for push state using react-redux with connect --- FAQ.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/FAQ.md b/FAQ.md index eb76a9ab..84b57eef 100644 --- a/FAQ.md +++ b/FAQ.md @@ -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: +
{ + + /** do something before redirection */ + props.push('/home'); + +}}>login
+ +// connect the action: +export default connect(null, { push })(Component); +``` + #### in redux thunk ```js import { push } from 'connected-react-router'