trying to navigate the users to differrent websites upon registration
handleSubmit = () => {
code
if(registered){
Navigate to external link
}
}
Im trying to use <Link to={{ pathname: 'res.data.storeRegistrationLink' }}/>
but its not working.
CodePudding user response:
Use this code:
window.location.href === `${res.data.storeRegistrationLink}`
CodePudding user response:
if you're using react-router-dom you can easily redirect the user after the condition is true like the following:
handleSubmit = () => {
code
if(registered){
<Redirect to="/somewhere/else" />
}
}