LoginCompontent
componentWillReceiveProps(nextProps) {
const router = this.context.router;
const { query } = this.props.location;
if (!nextProps.success) {
return;
}
switch (nextProps.data.code) {
case 0:
query.next ? router.push(query.next) : router.push('/');
break;
case 1:
break;
default:
break;
}
}
CategoryCompontent
componentWillMount() {
const { params } = this.props;
this.props.fetchCategories(params.id);
}
Result

Hi!
Redux is a library that contains one thing: an event emitter that calls your reducer function. It can’t possibly be responsible for calling your React components. So it is not a bug here, and StackOverflow might be a better place to ask about this.
The lifecycle books are managed by React. If you see that componentWillMount runs twice it means the component was unmounted between those calls for some reason. You can set a breakpoint in componentWillUnmount and check the stack trace to see what is causing the component to unmount.
I hope this helps!
Most helpful comment
Hi!
Redux is a library that contains one thing: an event emitter that calls your reducer function. It can’t possibly be responsible for calling your React components. So it is not a bug here, and StackOverflow might be a better place to ask about this.
The lifecycle books are managed by React. If you see that
componentWillMountruns twice it means the component was unmounted between those calls for some reason. You can set a breakpoint incomponentWillUnmountand check the stack trace to see what is causing the component to unmount.I hope this helps!