The repository provides a demo for using use-thunk.
More specifically:
- Implement thunk-modules parent, child, grandChild and the corresponding ui-components Parent, Child, GrandChild.
- Implement thunk-module user as the ui-component-independent thunk-module.
- We can see that
userinfo are shared across Header, Parent, and GrandChild. - We can see from Parent that there is only 1 default
parent. Thisparentis shared in main and in App - The children ids in Parent are generated independently. Therefore, there are 4 different children in the corresponding Child components.
- We can see that grand children ids are defined in Parent and passed through
Children's parameters. There are totally 8 different grand children in the corresponding GrandChild components. - We can see that parent and child are equipped with async counter. The counters of parent (1 parent) and children (4 children) work independently.
- Through filtering
childin the console log and adjusting all intervals of children to be 10 seconds, we can that updating 1 grandChild successfully re-renders object-wise GrandChild without re-rendering Parent, Child, and other GrandChildren.