import React, { Redirect, Route } from 'react-router-dom'; export function ProtectedRoute({ component: Component, path, isAuthorized, redirectPath, routes, ...rest }) { return ( { if (!isAuthorized || isAuthorized()) { return ; } return ( ); }} /> ); }