React uses axios to call the background data. After success, how to jump to the page based on the returned value?

1. Write the landing page with react, after calling the background data with axios, judge the route of the page to jump according to the return value, how to jump?
2.axios.get ("/ login/login.action?username="+name+"&password="+pd, {

)
timeout: 1000,

})

.then(function (response) {
    console.log(response.data.data.user_code);
    if(response.data.data.user_code=="04"){
        console.log("04/List.js");
    }else if(response.data.data.user_code=="05"){
        console.log("05/User.js");
    }else if(response.data.data.user_code=="06"){
        console.log("06/Num.js");
    }
})
.catch(function (error) {
    console.log(error);
});

3.
clipboard.png

Feb.26,2021

I don't know what you use with router . We usually use ides/philosophy" rel=" nofollow noreferrer > react-router .
react-router has a push or replace method.

Menu