使用 React,redux-form,SubmitSuccess 后如何重定向?
With React, redux-form, how to redirect after SubmitSuccess?
我的 redux-form 提交成功后,我想将用户重定向到一个新的 URL。
这是我正在尝试的:
SignUp = reduxForm({
form: 'SignUp',
onSubmitSuccess: () => {
console.log('onSubmitSuccess called');
return <Redirect to="/hello" />
}
})(SignUp);
控制台日志在表单提交成功后出现。知道为什么 React 或 redux-form 没有重定向吗?
我正在使用:
"react-router-dom": "^4.1.1",
"react-router-redux": "^5.0.0-alpha.6",
"redux": "^3.6.0",
"redux-form": "^6.6.3",
谢谢
import { push } from 'react-router-redux';
SignUp = reduxForm({
form: 'SignUp',
onSubmit: submit, // submit function must be return promise, for call onSubmitSuccess
onSubmitSuccess: (result, dispatch) => dispatch(push('/hello'))
})(SignUp);
我的 redux-form 提交成功后,我想将用户重定向到一个新的 URL。
这是我正在尝试的:
SignUp = reduxForm({
form: 'SignUp',
onSubmitSuccess: () => {
console.log('onSubmitSuccess called');
return <Redirect to="/hello" />
}
})(SignUp);
控制台日志在表单提交成功后出现。知道为什么 React 或 redux-form 没有重定向吗?
我正在使用:
"react-router-dom": "^4.1.1",
"react-router-redux": "^5.0.0-alpha.6",
"redux": "^3.6.0",
"redux-form": "^6.6.3",
谢谢
import { push } from 'react-router-redux';
SignUp = reduxForm({
form: 'SignUp',
onSubmit: submit, // submit function must be return promise, for call onSubmitSuccess
onSubmitSuccess: (result, dispatch) => dispatch(push('/hello'))
})(SignUp);