| From the React docs:
You can’t use Hooks inside of a class component, but you can definitely mix classes and function components with Hooks in a single tree. Whether a component is a class or a function that uses Hooks is an implementation detail of that component. In the longer term, we expect Hooks to be the primary way people write React components.
|
Given the above, it's not possible to use hooks from within a class component. Thus I think we should re-think our approach to refactoring where we have subtasks to use hooks for local state in a container component, as all our container components are class components. If we can connect functional components to our redux store (which seems possible from poc code by David Ffrench) the most straightforward solution may be to convert all container components to be functional components. This will increase the scope of the refactoring work involved in this task, which is worth highlighting before we tackle this work I think. cc Enda Phelan Laura Fitzgerald |