score:1

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

const EventDetails = (props) => {
  const { state } = useLocation();

  if (!state.post) return null;

  return (
    // ...render all the post fields available from state.post
    // i.e. state.post.title
  );
};

Related Query

More Query from same tag