Skip to content

Use hooks for contexts

Christina Jenks requested to merge use-hooks-for-contexts into main

Something that can be washed in gradually:

Instead of using contexts like:

const {...} = useContext(SomeContext);

Instead expose the context through hooks:

const {...} = useSomeContext();

This can be useful for preventing type name collisions, and for reducing the number of required imports (from the Context and useContext, to just the hook)

Merge request reports