DEV Community

幻魂
幻魂

Posted on

React query list , inspired by Dan Abramov

Here is an online demo come from Dan Abramov

Here is an online demo which rewrite with Concent, attention that I use setup feature to share logic between class component and function component.

The last online demo is totally the same with second one except that all the component ins share one common state.

For the purpose, I only change a little code

  • in function component, change the hook useConcent's options param
const ctx = useConcent({ state:iState, setup });
// ---> change to
const ctx = useConcent({ module:'queryList', setup });
  • in class component, change the decorator register's options param
@register({ setup })
// ---> change to
@register({ module:'queryList', setup })

end

Star Concent if you are interested in it, I will be so thankful!

More details see Concent git repo
or see Concent official doc

Top comments (0)