airbnb / airbnb/javascript

[React] Advise using Provider components (or HOC) to set context and higher order components to access context

Open
#967 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
148k
Forks
26.6k
PR merge metrics
No merged PRs in 30d

Description

What do folks think about adding some guidelines around setting and accessing context? Specifically, recommending that context is only set via specialized "Provider" components or perhaps a higher order component, and context is only accessed via specialized higher order components?

Here are some resources on this topic:
- https://medium.com/@bloodyowl/the-provider-and-higher-order-component-patterns-with-react-d16ab2d1636#.w7h9mkqrd
- https://github.com/facebook/react/issues/6525#issuecomment-225395131
- https://gist.github.com/ryanflorence/1e1290571337ebcea1c5a748e8f5b37d

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the linked Provider and higher-order component resources and the referenced React discussion. Determine where the style guide documents React patterns, then clarify the proposed guidance for setting and accessing context with maintainers. Done means the agreed recommendation is added to the appropriate guide section.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
documentation, frontend
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.