El estado de aprobación en Link React

import { useNavigate } from "react-router-dom";
const history = useNavigate();

history('/send-message', {state: 'data'});


import { useLocation } from "react-router-dom";
const location = useLocation();

console.log(location.state);
Niraj Kafle