MENU
'generatePath'
The generatePath function is used to generate a URL by replacing :segments in a path pattern with the corresponding object properties.
import { generatePath } from "react-router";
generatePath("/user/:id/:entity", {
id: 1,
entity: "posts",
});
// Will return /user/1/postsRegex constraint groups on a segment, like the old ":entity(posts|comments)" syntax, are no longer supported in path patterns – validate that "entity" is one of the values you expect in your own code instead of in the pattern string.