Recoil: class component support?

Created on 17 May 2020  路  4Comments  路  Source: facebookexperimental/Recoil

Most helpful comment

Recoil is specifically designed to do things in a "Reactish" way and support new React paradigms such as hooks, suspense, concurrent rendering, etc. As React hooks require function components, Recoil also requires function components; function components are the future.

All 4 comments

Recoil is specifically designed to do things in a "Reactish" way and support new React paradigms such as hooks, suspense, concurrent rendering, etc. As React hooks require function components, Recoil also requires function components; function components are the future.

If you really wanted to you could make a HOC that bridges Recoil with class components. We used to have one but found the types were too complicated to maintain. You can also manually create function components that pass recoil values in as props. What we've done is just refactor components to functional as needed.

@davidmccabe have any example please?

@kivervinicius you can find some examples on this question on StackOverflow.

Was this page helpful?
0 / 5 - 0 ratings