Skip to content

Instantly share code, notes, and snippets.

@tswistak
Last active May 17, 2019 10:19
Show Gist options
  • Save tswistak/bd1a4ed0f705581befaa128c92b909e5 to your computer and use it in GitHub Desktop.
Save tswistak/bd1a4ed0f705581befaa128c92b909e5 to your computer and use it in GitHub Desktop.
InversifyJS with React Hooks, listing 2
import React from 'react';
import { Container } from 'inversify';
const InversifyContext = React.createContext<{ container: Container | null }>({ container: null });
type Props = {
container: Container;
};
export const Provider: React.FC<Props> = (props) => {
return (
<InversifyContext.Provider value={{ container: props.container }}>
{props.children}
</InversifyContext.Provider>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment