How to redirect after success from ajax call using React-router-component?

后端 未结 3 1282
臣服心动
臣服心动 2021-02-14 10:23

I am building a application using Facebook flux architecture of React JS. I have build the basic part of app where I have a login form. I am fetching t

3条回答
  •  南旧
    南旧 (楼主)
    2021-02-14 10:51

    This should work

    var Store = require('Store');
    var Navigatable = require('react-router-component').NavigatableMixin
    
    var LoginComponent = React.createClass({
        mixins: [ Navigatable ],
    
        onClick: function() {
            Store.login(function(userId){
                this.navigate('/user/' + userId)
            }.bind(this));
        },
    
        render: function() {
            return ;
        }
    });
    

提交回复
热议问题