diff --git a/README.md b/README.md index 9eb21fd..93caa2a 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,20 @@ export default class Inside extends React.PureComponent { } ``` +Or use hooks(Caution: it rerenders on every change) with `useRexContext`: + +```tsx +let HooksChild: SFC = (props) => { + let contextData = useRexContext((store: IGlobalStore) => { + return { data: store.data }; + }); + + return ( +
{JSON.stringify(contextData, null, 2)}
+ ); +}; +``` + ### Workflow https://github.com/jimengio/ts-workflow