UNPKG

@inspectph/react-easy-router

Version:

A simple React router wrapper with protected routes, role-based access, and layout support for React apps.

32 lines (27 loc) 759 B
import * as React$1 from 'react'; import { ReactNode } from 'react'; interface ProtectedRouteProps { isAuthenticated: boolean; userRole?: string; allowedRoles?: string[]; redirectTo: string; children: React$1.ReactNode; } declare const ProtectedRoute: React$1.FC<ProtectedRouteProps>; interface RouteConfig { path: string; element: ReactNode; protected?: boolean; roles?: string[]; redirectTo?: string; layout?: React.ComponentType<{ children: ReactNode; }>; } interface RouterProviderProps { routes: RouteConfig[]; isAuthenticated: boolean; userRole?: string; } declare const RouterProvider: React$1.FC<RouterProviderProps>; export { ProtectedRoute, type RouteConfig, RouterProvider };