-
-
Save vman/c8bfbbca207a6b73eac2b4958e77ec7c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react'; | |
import { useContext } from 'react'; | |
import { AppContext } from './AppContext'; | |
//Infuse all components wrapped with this Higher Order Component with the serviceScope | |
export const withServiceScope = (Component: any) => { | |
return (props: any) => { | |
const appContext = useContext(AppContext); | |
return <Component serviceScope={appContext.serviceScope} {...props} />; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment