import { AuthContextProps } from './AuthContextInterface' ; import { useAuth } from './useAuth' ; import React from 'react' ; /**
 * A public higher-order component to access the imperative API
 */ export function withAuth < P extends AuthContextProps > ( Component ) { const displayName = `withAuth(${ Component . displayName || Component . name })` ; const C = ( props ) => { const auth = useAuth ( ) ; return < Component { ... ( props as P ) } { ... auth } />; } ; C . displayName = displayName ; return C ; }