import { useRouteMatch } from "react-router-dom"; function BlogPost() { let match = useRouteMatch("/blog/:slug"); // Do whatever you want with the match... return <div />; }