Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

can i pass data with usenavigate react router

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

 function ComponentB() {

    const location = useLocation();
   
        return (

            <>
               
<div>{location.state.name}</div>

            </>
        )
    }

export default ComponentB;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pass #data #usenavigate #react #router
ADD COMMENT
Topic
Name
6+4 =