'How to send props to component by using useNavigate in React Router? [duplicate]

I want to directly send props to a component. Is there a way to do this?

const navigate = useNavigate();

useEffect(()=>{

                .....
        
     
                    navigate ("/projectpage"); //send props here
           
    },[]);


Solution 1:[1]

The most common way of tackling this need is to pass the data as params to your navigation that you can access with the useParams hook.

Here's the docs from React Router

Here's a good guide on how to use it in practice

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jorge