Location <- Navigate

PHOTO EMBED

Mon Jan 22 2024 05:00:37 GMT+0000 (Coordinated Universal Time)

Saved by @KhanhDu #javascript

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

const ProfileTwo = () => {
  const location = useLocation();
  const data = location.state;

  return (
    <div>
      <p>Name: {data.name}</p>
      <p>Age: {data.age}</p>
      Hello
    </div>
  );
};

export default ProfileTwo;
content_copyCOPY

https://dev.to/esedev/how-to-pass-and-access-data-from-one-route-to-another-with-uselocation-usenavigate-usehistory-hooks-1g5m