#
useIsRouteProtected
Determine whether or not a route is considered as protected
.
To take advantage of this hook, make sure to add a $visibility hint to your public pages.
#
Reference
const isProtected = useIsRouteProtected(route)
#
Parameters
route
: ARoute
object.
#
Returns
A boolean
value indicating whether or not the matching route is protected
.
#
Usage
import { useLocation } from "react-router-dom";
import { useIsRouteProtected, useRouteMatch } from "@squide/firefly";
const location = useLocation();
const route = useRouteMatch(location);
const isActiveRouteProtected = useIsRouteProtected(route);