Skip to content

Commit

Permalink
document syntax of hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenYong committed Mar 11, 2019
1 parent 966c72a commit e5b364e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,20 @@ export default class Inside extends React.PureComponent<IProps, IState> {
}
```

Or use hooks(Caution: it rerenders on every change) with `useRexContext`:

```tsx
let HooksChild: SFC<IProps> = (props) => {
let contextData = useRexContext((store: IGlobalStore) => {
return { data: store.data };
});

return (
<pre>{JSON.stringify(contextData, null, 2)}</pre>
);
};
```

### Workflow

https://github.com/jimengio/ts-workflow
Expand Down

0 comments on commit e5b364e

Please sign in to comment.