Last active
May 17, 2019 10:19
-
-
Save tswistak/bd1a4ed0f705581befaa128c92b909e5 to your computer and use it in GitHub Desktop.
InversifyJS with React Hooks, listing 2
This file contains hidden or 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 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