Home How to redirect in redux after registration?
Reply: 0

How to redirect in redux after registration?

user1131 Published in May 24, 2018, 3:52 pm

I have created a signup form in react redux and it works as expected. The problem is that I have tried to push / in hash route to redirect user to dashboard, but it gives an error. I even used router in context as below:

if (this.isValid()) {
      // dispatching request for user sing up
          .then(response => {
              this.setState({isLoading: false});
          .catch(error => {
              this.setState({errors: error.response.data, isLoading: false});

In the Register component file that I have written the above code, I have the below code as well (outside of component class):

Register.contextTypes = {
    router: PropTypes.object.isRequired

This does not give any error. How should I implement the redirect? It seems that react-router behaves differently in newer version.

Version: "react-redux": "^5.0.6"

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.43811 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO