You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Simple API for <i>extending</i> rather than <i>replacing</i> React.Context values
2
+
Simple API for _extending_ rather than _replacing_ React.Context values. Lightweight, and has zero dependencies.
3
3
4
+
## Why
5
+
React provides the Context API to provide a React tree with props/state without having to rely on props drilling. This is great for single values, but is not as easy when dealing with multiple values. This package allows specifying _part_ of the value, and extends on top of any previous values from the tree.
4
6
5
7
## Installation
6
-
7
8
This module is distributed via [npm][npm] and
8
9
should be installed as one of your project's regular `dependencies`:
9
10
10
11
```
11
12
yarn add react-extend-context
12
13
```
13
-
14
14
or
15
-
16
15
```
17
16
npm install react-extend-context
18
17
```
@@ -24,32 +23,26 @@ The API for this package is meant to be simple and succinct. The only assumption
24
23
25
24
There are two exports for the package: the default `ReactExtendContext` component and a named Higher-Order Component `withExtendedContext` export.
The only other export from this package is the named export `withExtendedContext`. Generally, you don't deal with too many different types of React.Context, so this HOC provides a way to scope your context without having to constantly pass it down.
78
+
The only other export from this package is the named export `withExtendedContext`. Generally, you don't deal with too many different types of React.Context, so this HOC provides a way to scope your context without having to pass it down at every level.
82
79
83
80
The signature that it expects is identical to ReactExtendContext, but you no longer have to pass Context at each level.
0 commit comments