Context/State Hooks

Refactoring a class based implementation.