Skip to content

Instantly share code, notes, and snippets.


vman/withServiceScope.tsx Secret

Created Feb 2, 2020
What would you like to do?
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
You can’t perform that action at this time.