Skip to content
Snippets Groups Projects

Use hooks for contexts

Merged 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

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading