crud react

import {useHistory} from 'react-redirect-dom'

let history=useHistory();


 const onsubmit=async()=>{

e.preventDefault();

await Axios.post('url',state);

//for redirect

history.push('/');//redirect page like /about /contact  etc.....

}

/................................................................................................................/

Just make sure that you've added to props to <Link> otherwise you would also get the same error.

after adding it should look something like this:-

<Link to="#">


/.............................................../
useparams:0---

Comments

Popular posts from this blog

interview questions js[ Anurag Singh ProCodrr]

reactnative_creation