Skip to content

Floating Routes (not in a Switch) #8907

Discussion options

You must be logged in to vote
import { useMatch } from "react-router-dom-v5-compat";

function Details() {
  const match = useMatch("/details/about");
  return (
    <div>
      <h1>Details</h1>
      {match && <h2>About</h2>}
    </div>
  );
};

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ryanflorence
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant