Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

pass data between router components

import {useLocation} from 'react-router-dom';

const Register=()=>{

const location = useLocation()

//store the state in a variable if you want 
//location.state then the property or object you want

const Name = location.state.name

return(
  <div>
    hello my name is {Name}
  </div>
)

}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pass #data #router #components
ADD COMMENT
Topic
Name
1+6 =