Skip to content

Instantly share code, notes, and snippets.

@tswistak
Created May 8, 2019 15:53
Show Gist options
  • Save tswistak/eb0a93bc452340c481899b7e0275765e to your computer and use it in GitHub Desktop.
Save tswistak/eb0a93bc452340c481899b7e0275765e to your computer and use it in GitHub Desktop.
InversifyJS with React Hooks, listing 5
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