Skip to content
Advertisement

How to use Link and Route inside of condition term

So I am trying to move through pages in react, my goal is when I did validate the things I need (name, and number) the page will switch and I will be in another route. (without refresh the page). I tried to do it with window.location but its refreshing the page

I cant use <Link> because I want to switch route only after the validation (inside IF condition) or I can and I don’t know-how. my code :

JavaScript

Advertisement

Answer

I think what you want to achieve is to Redirect the page when you meet a condition

in this case

JavaScript
Advertisement