import { cloneElement , ReactElement } from 'react' ; import useAuthenticated from './useAuthenticated' ; export interface AuthenticatedProps { children : ReactElement < any > ; authParams ? : object ; location ? : object ; } see useAuthenticated example const Authenticated = ( props ) => { const { authParams , children , location , ... rest } = props ; useAuthenticated ( authParams ) ; return cloneElement ( children , rest ) ; } ; export default Authenticated ;