File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 11import React from 'react' ;
2- import * as MessageSource from 'react-message-source' ;
2+ import { Provider as MessageSourceProvider } from 'react-message-source' ;
33
4+ import Hooks from './Hooks' ;
45import {
56 LocalizedLabel ,
67 LocalizedLabelCurried ,
@@ -18,15 +19,13 @@ export default function App() {
1819 < React . Fragment >
1920 < p > The content below is localized, see Greeting.js for more information.</ p >
2021
21- < MessageSource . Provider value = { translations } >
22+ < MessageSourceProvider value = { translations } >
2223 < LocalizedLabel />
23-
2424 < LocalizedLabelCurried />
25-
2625 < PrefixedLocalizedLabel />
27-
2826 < LocalizedLabelWithNamedParams />
29- </ MessageSource . Provider >
27+ < Hooks />
28+ </ MessageSourceProvider >
3029 </ React . Fragment >
3130 ) ;
3231}
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import { useMessageSource } from 'react-message-source' ;
3+
4+ export default function Hooks ( ) {
5+ const { getMessage } = useMessageSource ( ) ;
6+ return < span > Translation with a hook: { getMessage ( 'hello.world' ) } </ span > ;
7+ }
You can’t perform that action at this time.
0 commit comments