DEV Community

loading...

React query list , inspired by Dan Abramov

幻魂
Concent is a predictable、zero-cost-use、progressive、high performance's enhanced state management solution.
・1 min read

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

Discussion (0)

Forem Open with the Forem app