Created
May 8, 2019 15:53
-
-
Save tswistak/eb0a93bc452340c481899b7e0275765e to your computer and use it in GitHub Desktop.
InversifyJS with React Hooks, listing 5
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 { useInjection } from './ioc.react'; | |
import { IProvider } from './providers'; | |
export const Hello: React.FC = () => { | |
const provider = useInjection<IProvider<string>>('nameProvider'); | |
return ( | |
<h1>Hello {provider.provide()}!</h1> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment