import { Context , useContext } from 'react' ; export function withContext < T > ( context ) { return ( Component ) => ( ownProps ) => { const contextProps = useContext ( context ) ; return < Component { ... ownProps } { ... contextProps } />; } ; }