Primitives

useMatch

Edit this page

useMatch takes an accessor that returns the path and creates a Memo that returns match information if the current path matches the provided path. Useful for determining if a given path matches the current route.

const match = useMatch(() => props.href);
return <div classList={{ active: Boolean(match()) }} />;
Report an issue with this page