@fluentui/react-context-selector 0.0.0-nightly-20220302-0405.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +1136 -0
- package/CHANGELOG.md +498 -0
- package/LICENSE +15 -0
- package/README.md +124 -0
- package/dist/react-context-selector.d.ts +44 -0
- package/lib/createContext.d.ts +2 -0
- package/lib/createContext.js +60 -0
- package/lib/createContext.js.map +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -0
- package/lib/tsdoc-metadata.json +11 -0
- package/lib/types.d.ts +19 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/lib/useContextSelector.d.ts +7 -0
- package/lib/useContextSelector.js +84 -0
- package/lib/useContextSelector.js.map +1 -0
- package/lib/useHasParentContext.d.ts +9 -0
- package/lib/useHasParentContext.js +19 -0
- package/lib/useHasParentContext.js.map +1 -0
- package/lib-commonjs/createContext.d.ts +2 -0
- package/lib-commonjs/createContext.js +71 -0
- package/lib-commonjs/createContext.js.map +1 -0
- package/lib-commonjs/index.d.ts +4 -0
- package/lib-commonjs/index.js +38 -0
- package/lib-commonjs/index.js.map +1 -0
- package/lib-commonjs/types.d.ts +19 -0
- package/lib-commonjs/types.js +6 -0
- package/lib-commonjs/types.js.map +1 -0
- package/lib-commonjs/useContextSelector.d.ts +7 -0
- package/lib-commonjs/useContextSelector.js +95 -0
- package/lib-commonjs/useContextSelector.js.map +1 -0
- package/lib-commonjs/useHasParentContext.d.ts +9 -0
- package/lib-commonjs/useHasParentContext.js +29 -0
- package/lib-commonjs/useHasParentContext.js.map +1 -0
- package/package.json +55 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
# Change Log - @fluentui/react-context-selector
|
|
2
|
+
|
|
3
|
+
This log was last generated on Wed, 02 Mar 2022 04:14:53 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
<!-- Start content -->
|
|
6
|
+
|
|
7
|
+
## [0.0.0-nightly-20220302-0405.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v0.0.0-nightly-20220302-0405.1)
|
|
8
|
+
|
|
9
|
+
Wed, 02 Mar 2022 04:14:53 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-rc.4..@fluentui/react-context-selector_v0.0.0-nightly-20220302-0405.1)
|
|
11
|
+
|
|
12
|
+
### Changes
|
|
13
|
+
|
|
14
|
+
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/53b1c4f7ec45eabb24152a601ce3341b825b3aec) by email not defined)
|
|
15
|
+
- Bump @fluentui/react-utilities to v0.0.0-nightly-20220302-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/53b1c4f7ec45eabb24152a601ce3341b825b3aec) by beachball)
|
|
16
|
+
|
|
17
|
+
## [9.0.0-rc.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-rc.4)
|
|
18
|
+
|
|
19
|
+
Tue, 01 Mar 2022 02:17:40 GMT
|
|
20
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-rc.3..@fluentui/react-context-selector_v9.0.0-rc.4)
|
|
21
|
+
|
|
22
|
+
### Changes
|
|
23
|
+
|
|
24
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.4 ([PR #21884](https://github.com/microsoft/fluentui/pull/21884) by beachball)
|
|
25
|
+
|
|
26
|
+
## [9.0.0-rc.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-rc.3)
|
|
27
|
+
|
|
28
|
+
Fri, 18 Feb 2022 13:35:31 GMT
|
|
29
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-rc.1..@fluentui/react-context-selector_v9.0.0-rc.3)
|
|
30
|
+
|
|
31
|
+
### Changes
|
|
32
|
+
|
|
33
|
+
- fix: Source maps contain original source code ([PR #21690](https://github.com/microsoft/fluentui/pull/21690) by lingfangao@hotmail.com)
|
|
34
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
|
35
|
+
|
|
36
|
+
## [9.0.0-rc.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-rc.1)
|
|
37
|
+
|
|
38
|
+
Thu, 10 Feb 2022 08:51:09 GMT
|
|
39
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-beta.4..@fluentui/react-context-selector_v9.0.0-rc.1)
|
|
40
|
+
|
|
41
|
+
### Changes
|
|
42
|
+
|
|
43
|
+
- Bump Fluent UI packages to 9.0.0-rc ([PR #21623](https://github.com/microsoft/fluentui/pull/21623) by lingfangao@hotmail.com)
|
|
44
|
+
- Allow React 17 in peerDependencies. ([PR #21544](https://github.com/microsoft/fluentui/pull/21544) by tristan.watanabe@gmail.com)
|
|
45
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
|
|
46
|
+
|
|
47
|
+
## [9.0.0-beta.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-beta.4)
|
|
48
|
+
|
|
49
|
+
Thu, 25 Nov 2021 08:34:13 GMT
|
|
50
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-beta.3..@fluentui/react-context-selector_v9.0.0-beta.4)
|
|
51
|
+
|
|
52
|
+
### Changes
|
|
53
|
+
|
|
54
|
+
- Bump @fluentui/react-utilities to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
|
|
55
|
+
|
|
56
|
+
## [9.0.0-beta.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-beta.3)
|
|
57
|
+
|
|
58
|
+
Fri, 12 Nov 2021 13:25:22 GMT
|
|
59
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-beta.2..@fluentui/react-context-selector_v9.0.0-beta.3)
|
|
60
|
+
|
|
61
|
+
### Changes
|
|
62
|
+
|
|
63
|
+
- Updated beta and RC components to ES2019 ([PR #20405](https://github.com/microsoft/fluentui/pull/20405) by gcox@microsoft.com)
|
|
64
|
+
- Bump @fluentui/react-utilities to v9.0.0-beta.3 ([PR #20583](https://github.com/microsoft/fluentui/pull/20583) by beachball)
|
|
65
|
+
|
|
66
|
+
## [9.0.0-beta.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-beta.2)
|
|
67
|
+
|
|
68
|
+
Wed, 27 Oct 2021 12:14:24 GMT
|
|
69
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-beta.1..@fluentui/react-context-selector_v9.0.0-beta.2)
|
|
70
|
+
|
|
71
|
+
### Changes
|
|
72
|
+
|
|
73
|
+
- Bump @fluentui/react-utilities to v9.0.0-beta.2 ([PR #20353](https://github.com/microsoft/fluentui/pull/20353) by beachball)
|
|
74
|
+
|
|
75
|
+
## [9.0.0-beta.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-beta.1)
|
|
76
|
+
|
|
77
|
+
Wed, 06 Oct 2021 10:37:22 GMT
|
|
78
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.39..@fluentui/react-context-selector_v9.0.0-beta.1)
|
|
79
|
+
|
|
80
|
+
### Changes
|
|
81
|
+
|
|
82
|
+
- Bump all v9 components to beta prerelease tag ([PR #20106](https://github.com/microsoft/fluentui/pull/20106) by lingfangao@hotmail.com)
|
|
83
|
+
- Bump @fluentui/react-utilities to v9.0.0-beta.1 ([PR #20106](https://github.com/microsoft/fluentui/pull/20106) by beachball)
|
|
84
|
+
|
|
85
|
+
## [9.0.0-alpha.39](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.39)
|
|
86
|
+
|
|
87
|
+
Tue, 05 Oct 2021 09:28:07 GMT
|
|
88
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.38..@fluentui/react-context-selector_v9.0.0-alpha.39)
|
|
89
|
+
|
|
90
|
+
### Changes
|
|
91
|
+
|
|
92
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.56 ([PR #20081](https://github.com/microsoft/fluentui/pull/20081) by beachball)
|
|
93
|
+
|
|
94
|
+
## [9.0.0-alpha.38](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.38)
|
|
95
|
+
|
|
96
|
+
Fri, 01 Oct 2021 14:13:08 GMT
|
|
97
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.36..@fluentui/react-context-selector_v9.0.0-alpha.38)
|
|
98
|
+
|
|
99
|
+
### Changes
|
|
100
|
+
|
|
101
|
+
- Bump v9 prerelease versions to rerelease ([PR #20069](https://github.com/microsoft/fluentui/pull/20069) by lingfangao@hotmail.com)
|
|
102
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.55 ([PR #20069](https://github.com/microsoft/fluentui/pull/20069) by beachball)
|
|
103
|
+
|
|
104
|
+
## [9.0.0-alpha.36](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.36)
|
|
105
|
+
|
|
106
|
+
Mon, 27 Sep 2021 08:06:00 GMT
|
|
107
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.35..@fluentui/react-context-selector_v9.0.0-alpha.36)
|
|
108
|
+
|
|
109
|
+
### Changes
|
|
110
|
+
|
|
111
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.53 ([PR #19981](https://github.com/microsoft/fluentui/pull/19981) by beachball)
|
|
112
|
+
|
|
113
|
+
## [9.0.0-alpha.35](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.35)
|
|
114
|
+
|
|
115
|
+
Fri, 24 Sep 2021 09:17:17 GMT
|
|
116
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.34..@fluentui/react-context-selector_v9.0.0-alpha.35)
|
|
117
|
+
|
|
118
|
+
### Changes
|
|
119
|
+
|
|
120
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.52 ([PR #19950](https://github.com/microsoft/fluentui/pull/19950) by beachball)
|
|
121
|
+
|
|
122
|
+
## [9.0.0-alpha.34](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.34)
|
|
123
|
+
|
|
124
|
+
Thu, 23 Sep 2021 08:21:34 GMT
|
|
125
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.33..@fluentui/react-context-selector_v9.0.0-alpha.34)
|
|
126
|
+
|
|
127
|
+
### Changes
|
|
128
|
+
|
|
129
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.51 ([commit](https://github.com/microsoft/fluentui/commit/95682da34c48813f7658032ae490d21d2f363b90) by beachball)
|
|
130
|
+
|
|
131
|
+
## [9.0.0-alpha.33](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.33)
|
|
132
|
+
|
|
133
|
+
Wed, 22 Sep 2021 10:10:07 GMT
|
|
134
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.32..@fluentui/react-context-selector_v9.0.0-alpha.33)
|
|
135
|
+
|
|
136
|
+
### Changes
|
|
137
|
+
|
|
138
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.50 ([commit](https://github.com/microsoft/fluentui/commit/bc3f1ec72fc7784a558b0dd6598ee0662f4649c1) by beachball)
|
|
139
|
+
|
|
140
|
+
## [9.0.0-alpha.32](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.32)
|
|
141
|
+
|
|
142
|
+
Fri, 17 Sep 2021 07:35:26 GMT
|
|
143
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.31..@fluentui/react-context-selector_v9.0.0-alpha.32)
|
|
144
|
+
|
|
145
|
+
### Changes
|
|
146
|
+
|
|
147
|
+
- Bump @fluentui/react-context-selector to v9.0.0-alpha.32 ([PR #19840](https://github.com/microsoft/fluentui/pull/19840) by Humberto.Morimoto@microsoft.com)
|
|
148
|
+
|
|
149
|
+
## [9.0.0-alpha.31](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.31)
|
|
150
|
+
|
|
151
|
+
Thu, 16 Sep 2021 07:38:39 GMT
|
|
152
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.30..@fluentui/react-context-selector_v9.0.0-alpha.31)
|
|
153
|
+
|
|
154
|
+
### Changes
|
|
155
|
+
|
|
156
|
+
- Bump @fluentui/react-context-selector to v9.0.0-alpha.31 ([PR #19815](https://github.com/microsoft/fluentui/pull/19815) by behowell@microsoft.com)
|
|
157
|
+
|
|
158
|
+
## [9.0.0-alpha.30](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.30)
|
|
159
|
+
|
|
160
|
+
Tue, 14 Sep 2021 20:09:02 GMT
|
|
161
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.29..@fluentui/react-context-selector_v9.0.0-alpha.30)
|
|
162
|
+
|
|
163
|
+
### Changes
|
|
164
|
+
|
|
165
|
+
- Bump @fluentui/react-context-selector to v9.0.0-alpha.30 ([PR #19155](https://github.com/microsoft/fluentui/pull/19155) by bsunderhus@microsoft.com)
|
|
166
|
+
|
|
167
|
+
## [9.0.0-alpha.29](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.29)
|
|
168
|
+
|
|
169
|
+
Fri, 10 Sep 2021 16:31:53 GMT
|
|
170
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.28..@fluentui/react-context-selector_v9.0.0-alpha.29)
|
|
171
|
+
|
|
172
|
+
### Changes
|
|
173
|
+
|
|
174
|
+
- chore(v9): Move all internal v9 dependencies from caret to fixed version ([PR #19748](https://github.com/microsoft/fluentui/pull/19748) by lingfangao@hotmail.com)
|
|
175
|
+
- Bump @fluentui/react-context-selector to v9.0.0-alpha.29 ([PR #19748](https://github.com/microsoft/fluentui/pull/19748) by lingfangao@hotmail.com)
|
|
176
|
+
|
|
177
|
+
## [9.0.0-alpha.28](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.28)
|
|
178
|
+
|
|
179
|
+
Fri, 10 Sep 2021 07:39:51 GMT
|
|
180
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.27..@fluentui/react-context-selector_v9.0.0-alpha.28)
|
|
181
|
+
|
|
182
|
+
### Changes
|
|
183
|
+
|
|
184
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.45 ([PR #19642](https://github.com/microsoft/fluentui/pull/19642) by behowell@microsoft.com)
|
|
185
|
+
|
|
186
|
+
## [9.0.0-alpha.27](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.27)
|
|
187
|
+
|
|
188
|
+
Mon, 06 Sep 2021 07:34:53 GMT
|
|
189
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.26..@fluentui/react-context-selector_v9.0.0-alpha.27)
|
|
190
|
+
|
|
191
|
+
### Changes
|
|
192
|
+
|
|
193
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.44 ([PR #19640](https://github.com/microsoft/fluentui/pull/19640) by lingfangao@hotmail.com)
|
|
194
|
+
|
|
195
|
+
## [9.0.0-alpha.26](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.26)
|
|
196
|
+
|
|
197
|
+
Wed, 01 Sep 2021 07:39:56 GMT
|
|
198
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.25..@fluentui/react-context-selector_v9.0.0-alpha.26)
|
|
199
|
+
|
|
200
|
+
### Changes
|
|
201
|
+
|
|
202
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.43 ([PR #19483](https://github.com/microsoft/fluentui/pull/19483) by bsunderhus@microsoft.com)
|
|
203
|
+
|
|
204
|
+
## [9.0.0-alpha.25](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.25)
|
|
205
|
+
|
|
206
|
+
Tue, 31 Aug 2021 07:37:47 GMT
|
|
207
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.24..@fluentui/react-context-selector_v9.0.0-alpha.25)
|
|
208
|
+
|
|
209
|
+
### Changes
|
|
210
|
+
|
|
211
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.42 ([PR #19556](https://github.com/microsoft/fluentui/pull/19556) by lingfan.gao@microsoft.com)
|
|
212
|
+
|
|
213
|
+
## [9.0.0-alpha.24](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.24)
|
|
214
|
+
|
|
215
|
+
Fri, 20 Aug 2021 07:37:28 GMT
|
|
216
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.23..@fluentui/react-context-selector_v9.0.0-alpha.24)
|
|
217
|
+
|
|
218
|
+
### Changes
|
|
219
|
+
|
|
220
|
+
- Update .npmignore ([PR #19441](https://github.com/microsoft/fluentui/pull/19441) by elcraig@microsoft.com)
|
|
221
|
+
|
|
222
|
+
## [9.0.0-alpha.23](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.23)
|
|
223
|
+
|
|
224
|
+
Thu, 19 Aug 2021 07:41:35 GMT
|
|
225
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.22..@fluentui/react-context-selector_v9.0.0-alpha.23)
|
|
226
|
+
|
|
227
|
+
### Changes
|
|
228
|
+
|
|
229
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.39 ([PR #19273](https://github.com/microsoft/fluentui/pull/19273) by bsunderhus@microsoft.com)
|
|
230
|
+
|
|
231
|
+
## [9.0.0-alpha.22](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.22)
|
|
232
|
+
|
|
233
|
+
Fri, 06 Aug 2021 07:35:14 GMT
|
|
234
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.21..@fluentui/react-context-selector_v9.0.0-alpha.22)
|
|
235
|
+
|
|
236
|
+
### Changes
|
|
237
|
+
|
|
238
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.38 ([PR #19189](https://github.com/microsoft/fluentui/pull/19189) by bsunderhus@microsoft.com)
|
|
239
|
+
|
|
240
|
+
## [9.0.0-alpha.21](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.21)
|
|
241
|
+
|
|
242
|
+
Tue, 03 Aug 2021 07:39:30 GMT
|
|
243
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.20..@fluentui/react-context-selector_v9.0.0-alpha.21)
|
|
244
|
+
|
|
245
|
+
### Patches
|
|
246
|
+
|
|
247
|
+
- Bump @fluentui/eslint-plugin to v1.3.3 ([PR #19169](https://github.com/microsoft/fluentui/pull/19169) by behowell@microsoft.com)
|
|
248
|
+
- Bump @fluentui/scripts to v1.0.0 ([PR #19169](https://github.com/microsoft/fluentui/pull/19169) by behowell@microsoft.com)
|
|
249
|
+
|
|
250
|
+
### Changes
|
|
251
|
+
|
|
252
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.37 ([PR #19169](https://github.com/microsoft/fluentui/pull/19169) by behowell@microsoft.com)
|
|
253
|
+
|
|
254
|
+
## [9.0.0-alpha.20](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.20)
|
|
255
|
+
|
|
256
|
+
Mon, 02 Aug 2021 07:36:20 GMT
|
|
257
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.19..@fluentui/react-context-selector_v9.0.0-alpha.20)
|
|
258
|
+
|
|
259
|
+
### Changes
|
|
260
|
+
|
|
261
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.36 ([PR #19204](https://github.com/microsoft/fluentui/pull/19204) by lingfan.gao@microsoft.com)
|
|
262
|
+
|
|
263
|
+
## [9.0.0-alpha.19](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.19)
|
|
264
|
+
|
|
265
|
+
Fri, 23 Jul 2021 07:38:19 GMT
|
|
266
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.18..@fluentui/react-context-selector_v9.0.0-alpha.19)
|
|
267
|
+
|
|
268
|
+
### Changes
|
|
269
|
+
|
|
270
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.35 ([PR #18610](https://github.com/microsoft/fluentui/pull/18610) by behowell@microsoft.com)
|
|
271
|
+
|
|
272
|
+
## [9.0.0-alpha.18](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.18)
|
|
273
|
+
|
|
274
|
+
Thu, 22 Jul 2021 07:36:55 GMT
|
|
275
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.17..@fluentui/react-context-selector_v9.0.0-alpha.18)
|
|
276
|
+
|
|
277
|
+
### Changes
|
|
278
|
+
|
|
279
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.34 ([PR #19023](https://github.com/microsoft/fluentui/pull/19023) by behowell@microsoft.com)
|
|
280
|
+
|
|
281
|
+
## [9.0.0-alpha.17](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.17)
|
|
282
|
+
|
|
283
|
+
Thu, 15 Jul 2021 07:36:18 GMT
|
|
284
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.16..@fluentui/react-context-selector_v9.0.0-alpha.17)
|
|
285
|
+
|
|
286
|
+
### Changes
|
|
287
|
+
|
|
288
|
+
- feat(useHasParentContext): new hook to determine if a context provider exists as parent ([PR #18812](https://github.com/microsoft/fluentui/pull/18812) by lingfan.gao@microsoft.com)
|
|
289
|
+
|
|
290
|
+
## [9.0.0-alpha.16](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.16)
|
|
291
|
+
|
|
292
|
+
Fri, 09 Jul 2021 07:39:31 GMT
|
|
293
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.15..@fluentui/react-context-selector_v9.0.0-alpha.16)
|
|
294
|
+
|
|
295
|
+
### Patches
|
|
296
|
+
|
|
297
|
+
- Bump @fluentui/eslint-plugin to v1.3.2 ([PR #18808](https://github.com/microsoft/fluentui/pull/18808) by martinhochel@microsoft.com)
|
|
298
|
+
- Bump @fluentui/scripts to v1.0.0 ([PR #18808](https://github.com/microsoft/fluentui/pull/18808) by martinhochel@microsoft.com)
|
|
299
|
+
|
|
300
|
+
### Changes
|
|
301
|
+
|
|
302
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.32 ([PR #18808](https://github.com/microsoft/fluentui/pull/18808) by martinhochel@microsoft.com)
|
|
303
|
+
|
|
304
|
+
## [9.0.0-alpha.15](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.15)
|
|
305
|
+
|
|
306
|
+
Fri, 02 Jul 2021 23:15:55 GMT
|
|
307
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.14..@fluentui/react-context-selector_v9.0.0-alpha.15)
|
|
308
|
+
|
|
309
|
+
### Changes
|
|
310
|
+
|
|
311
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.31 ([PR #18721](https://github.com/microsoft/fluentui/pull/18721) by bsunderhus@microsoft.com)
|
|
312
|
+
|
|
313
|
+
## [9.0.0-alpha.14](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.14)
|
|
314
|
+
|
|
315
|
+
Fri, 02 Jul 2021 07:37:06 GMT
|
|
316
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.13..@fluentui/react-context-selector_v9.0.0-alpha.14)
|
|
317
|
+
|
|
318
|
+
### Changes
|
|
319
|
+
|
|
320
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.30 ([PR #18796](https://github.com/microsoft/fluentui/pull/18796) by bsunderhus@microsoft.com)
|
|
321
|
+
|
|
322
|
+
## [9.0.0-alpha.13](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.13)
|
|
323
|
+
|
|
324
|
+
Tue, 15 Jun 2021 07:40:20 GMT
|
|
325
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.12..@fluentui/react-context-selector_v9.0.0-alpha.13)
|
|
326
|
+
|
|
327
|
+
### Changes
|
|
328
|
+
|
|
329
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.29 ([PR #18521](https://github.com/microsoft/fluentui/pull/18521) by behowell@microsoft.com)
|
|
330
|
+
|
|
331
|
+
## [9.0.0-alpha.12](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.12)
|
|
332
|
+
|
|
333
|
+
Mon, 07 Jun 2021 07:38:15 GMT
|
|
334
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.11..@fluentui/react-context-selector_v9.0.0-alpha.12)
|
|
335
|
+
|
|
336
|
+
### Patches
|
|
337
|
+
|
|
338
|
+
- Bump @fluentui/eslint-plugin to v1.3.1 ([PR #18437](https://github.com/microsoft/fluentui/pull/18437) by martinhochel@microsoft.com)
|
|
339
|
+
- Bump @fluentui/scripts to v1.0.0 ([PR #18437](https://github.com/microsoft/fluentui/pull/18437) by martinhochel@microsoft.com)
|
|
340
|
+
|
|
341
|
+
### Changes
|
|
342
|
+
|
|
343
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.28 ([PR #18437](https://github.com/microsoft/fluentui/pull/18437) by martinhochel@microsoft.com)
|
|
344
|
+
|
|
345
|
+
## [9.0.0-alpha.11](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.11)
|
|
346
|
+
|
|
347
|
+
Fri, 04 Jun 2021 07:37:23 GMT
|
|
348
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.10..@fluentui/react-context-selector_v9.0.0-alpha.11)
|
|
349
|
+
|
|
350
|
+
### Changes
|
|
351
|
+
|
|
352
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.27 ([PR #18168](https://github.com/microsoft/fluentui/pull/18168) by Humberto.Morimoto@microsoft.com)
|
|
353
|
+
|
|
354
|
+
## [9.0.0-alpha.10](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.10)
|
|
355
|
+
|
|
356
|
+
Wed, 26 May 2021 07:35:43 GMT
|
|
357
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.9..@fluentui/react-context-selector_v9.0.0-alpha.10)
|
|
358
|
+
|
|
359
|
+
### Changes
|
|
360
|
+
|
|
361
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.25 ([PR #18323](https://github.com/microsoft/fluentui/pull/18323) by lingfan.gao@microsoft.com)
|
|
362
|
+
|
|
363
|
+
## [9.0.0-alpha.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.9)
|
|
364
|
+
|
|
365
|
+
Fri, 21 May 2021 07:34:54 GMT
|
|
366
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.8..@fluentui/react-context-selector_v9.0.0-alpha.9)
|
|
367
|
+
|
|
368
|
+
### Changes
|
|
369
|
+
|
|
370
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.24 ([PR #18259](https://github.com/microsoft/fluentui/pull/18259) by behowell@microsoft.com)
|
|
371
|
+
|
|
372
|
+
## [9.0.0-alpha.8](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.8)
|
|
373
|
+
|
|
374
|
+
Thu, 20 May 2021 07:41:54 GMT
|
|
375
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.7..@fluentui/react-context-selector_v9.0.0-alpha.8)
|
|
376
|
+
|
|
377
|
+
### Patches
|
|
378
|
+
|
|
379
|
+
- Bump @fluentui/eslint-plugin to v1.3.0 ([PR #18024](https://github.com/microsoft/fluentui/pull/18024) by elcraig@microsoft.com)
|
|
380
|
+
- Bump @fluentui/scripts to v1.0.0 ([PR #18024](https://github.com/microsoft/fluentui/pull/18024) by elcraig@microsoft.com)
|
|
381
|
+
|
|
382
|
+
### Changes
|
|
383
|
+
|
|
384
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.23 ([PR #18024](https://github.com/microsoft/fluentui/pull/18024) by elcraig@microsoft.com)
|
|
385
|
+
|
|
386
|
+
## [9.0.0-alpha.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.7)
|
|
387
|
+
|
|
388
|
+
Wed, 19 May 2021 07:34:20 GMT
|
|
389
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.6..@fluentui/react-context-selector_v9.0.0-alpha.7)
|
|
390
|
+
|
|
391
|
+
### Changes
|
|
392
|
+
|
|
393
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.22 ([PR #18037](https://github.com/microsoft/fluentui/pull/18037) by olfedias@microsoft.com)
|
|
394
|
+
|
|
395
|
+
## [9.0.0-alpha.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.6)
|
|
396
|
+
|
|
397
|
+
Mon, 03 May 2021 07:45:19 GMT
|
|
398
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.5..@fluentui/react-context-selector_v9.0.0-alpha.6)
|
|
399
|
+
|
|
400
|
+
### Changes
|
|
401
|
+
|
|
402
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.21 ([PR #18005](https://github.com/microsoft/fluentui/pull/18005) by lingfan.gao@microsoft.com)
|
|
403
|
+
|
|
404
|
+
## [9.0.0-alpha.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.5)
|
|
405
|
+
|
|
406
|
+
Fri, 30 Apr 2021 07:42:23 GMT
|
|
407
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.4..@fluentui/react-context-selector_v9.0.0-alpha.5)
|
|
408
|
+
|
|
409
|
+
### Patches
|
|
410
|
+
|
|
411
|
+
- Bump @fluentui/eslint-plugin to v1.2.0 ([PR #17932](https://github.com/microsoft/fluentui/pull/17932) by joschect@microsoft.com)
|
|
412
|
+
- Bump @fluentui/scripts to v1.0.0 ([PR #17932](https://github.com/microsoft/fluentui/pull/17932) by joschect@microsoft.com)
|
|
413
|
+
|
|
414
|
+
### Changes
|
|
415
|
+
|
|
416
|
+
- Upgrade to TS 4.0 ([PR #17932](https://github.com/microsoft/fluentui/pull/17932) by joschect@microsoft.com)
|
|
417
|
+
|
|
418
|
+
## [9.0.0-alpha.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.4)
|
|
419
|
+
|
|
420
|
+
Fri, 23 Apr 2021 07:37:10 GMT
|
|
421
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.3..@fluentui/react-context-selector_v9.0.0-alpha.4)
|
|
422
|
+
|
|
423
|
+
### Patches
|
|
424
|
+
|
|
425
|
+
- Bump @fluentui/eslint-plugin to v1.1.1 ([PR #17894](https://github.com/microsoft/fluentui/pull/17894) by olfedias@microsoft.com)
|
|
426
|
+
- Bump @fluentui/scripts to v1.0.0 ([PR #17894](https://github.com/microsoft/fluentui/pull/17894) by olfedias@microsoft.com)
|
|
427
|
+
|
|
428
|
+
### Changes
|
|
429
|
+
|
|
430
|
+
- Bump @fluentui/react-utilities to v9.0.0-alpha.19 ([PR #17894](https://github.com/microsoft/fluentui/pull/17894) by olfedias@microsoft.com)
|
|
431
|
+
|
|
432
|
+
## [9.0.0-alpha.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.3)
|
|
433
|
+
|
|
434
|
+
Thu, 22 Apr 2021 07:33:28 GMT
|
|
435
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.2..@fluentui/react-context-selector_v9.0.0-alpha.3)
|
|
436
|
+
|
|
437
|
+
### Changes
|
|
438
|
+
|
|
439
|
+
- use useIsomorphicEffect from @fluentui/react-utilities ([PR #17897](https://github.com/microsoft/fluentui/pull/17897) by olfedias@microsoft.com)
|
|
440
|
+
|
|
441
|
+
## [9.0.0-alpha.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.2)
|
|
442
|
+
|
|
443
|
+
Wed, 31 Mar 2021 00:53:43 GMT
|
|
444
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.0.0-alpha.1..@fluentui/react-context-selector_v9.0.0-alpha.2)
|
|
445
|
+
|
|
446
|
+
### Patches
|
|
447
|
+
|
|
448
|
+
- Bump @fluentui/eslint-plugin to v1.1.0 ([PR #17568](https://github.com/microsoft/fluentui/pull/17568) by elcraig@microsoft.com)
|
|
449
|
+
- Bump @fluentui/scripts to v1.0.0 ([PR #17568](https://github.com/microsoft/fluentui/pull/17568) by elcraig@microsoft.com)
|
|
450
|
+
|
|
451
|
+
## [9.0.0-alpha.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.0.0-alpha.1)
|
|
452
|
+
|
|
453
|
+
Tue, 30 Mar 2021 07:34:45 GMT
|
|
454
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v0.53.4..@fluentui/react-context-selector_v9.0.0-alpha.1)
|
|
455
|
+
|
|
456
|
+
### Changes
|
|
457
|
+
|
|
458
|
+
- Bump react-context-selector to v9 ([PR #17350](https://github.com/microsoft/fluentui/pull/17350) by lingfan.gao@microsoft.com)
|
|
459
|
+
- chore: restore "sideEffects" to enable treeshaking ([PR #17584](https://github.com/microsoft/fluentui/pull/17584) by olfedias@microsoft.com)
|
|
460
|
+
|
|
461
|
+
## [0.53.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v0.53.4)
|
|
462
|
+
|
|
463
|
+
Mon, 15 Mar 2021 07:36:20 GMT
|
|
464
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v0.53.3..@fluentui/react-context-selector_v0.53.4)
|
|
465
|
+
|
|
466
|
+
### Patches
|
|
467
|
+
|
|
468
|
+
- Remove set-version references ([PR #17381](https://github.com/microsoft/fluentui/pull/17381) by elcraig@microsoft.com)
|
|
469
|
+
|
|
470
|
+
## [0.53.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v0.53.3)
|
|
471
|
+
|
|
472
|
+
Fri, 26 Feb 2021 01:16:27 GMT
|
|
473
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v0.53.2..@fluentui/react-context-selector_v0.53.3)
|
|
474
|
+
|
|
475
|
+
### Patches
|
|
476
|
+
|
|
477
|
+
- update references to major-bumped packages ([PR #17169](https://github.com/microsoft/fluentui/pull/17169) by elcraig@microsoft.com)
|
|
478
|
+
|
|
479
|
+
## [0.53.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v0.53.2)
|
|
480
|
+
|
|
481
|
+
Mon, 22 Feb 2021 12:26:22 GMT
|
|
482
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v0.53.0..@fluentui/react-context-selector_v0.53.2)
|
|
483
|
+
|
|
484
|
+
### Patches
|
|
485
|
+
|
|
486
|
+
- Manually bump react-context-selector ([PR #17084](https://github.com/microsoft/fluentui/pull/17084) by elcraig@microsoft.com)
|
|
487
|
+
|
|
488
|
+
## [0.53.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v0.53.0)
|
|
489
|
+
|
|
490
|
+
Thu, 18 Feb 2021 19:38:50 GMT
|
|
491
|
+
|
|
492
|
+
### Minor changes
|
|
493
|
+
|
|
494
|
+
- Remove useContextSelectors to align with proposed React implementation ([PR #17049](https://github.com/microsoft/fluentui/pull/17049) by lingfan.gao@microsoft.com)
|
|
495
|
+
|
|
496
|
+
### Patches
|
|
497
|
+
|
|
498
|
+
- chore: fix version mismatch ([PR #17053](https://github.com/microsoft/fluentui/pull/17053) by olfedias@microsoft.com)
|
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@fluentui/react-context-selector
|
|
2
|
+
|
|
3
|
+
Copyright (c) Microsoft Corporation
|
|
4
|
+
|
|
5
|
+
All rights reserved.
|
|
6
|
+
|
|
7
|
+
MIT License
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
14
|
+
|
|
15
|
+
Note: Usage of the fonts and icons referenced in Fluent UI React is subject to the terms listed at https://aka.ms/fluentui-assets-license
|
package/README.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# `@fluentui/react-context-selector`
|
|
2
|
+
|
|
3
|
+
React `useContextSelector()` and `useContextSelectors()` hooks in userland.
|
|
4
|
+
|
|
5
|
+
## Introduction
|
|
6
|
+
|
|
7
|
+
[React Context](https://reactjs.org/docs/context.html) and [`useContext()`](https://reactjs.org/docs/hooks-reference.html#usecontext) is often used to avoid prop drilling,
|
|
8
|
+
however it's known that there's a performance issue. When a context value is changed, all components that are subscribed with `useContext()` will re-render.
|
|
9
|
+
|
|
10
|
+
[useContextSelector](https://github.com/reactjs/rfcs/pull/119) is recently proposed. While waiting for the process, this library provides the API in userland.
|
|
11
|
+
|
|
12
|
+
# Installation
|
|
13
|
+
|
|
14
|
+
**NPM**
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install --save @fluentui/react-context-selector
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Yarn**
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
yarn add @fluentui/react-context-selector
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
### Getting started
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import * as React from 'react';
|
|
32
|
+
import { createContext, useContextSelector, ContextSelector } from '@fluentui/react-context-selector';
|
|
33
|
+
|
|
34
|
+
interface CounterContextValue {
|
|
35
|
+
count1: number;
|
|
36
|
+
count2: number;
|
|
37
|
+
incrementCount1: () => void;
|
|
38
|
+
incrementCount2: () => void;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// 💡 The same syntax as native React context API
|
|
42
|
+
// https://reactjs.org/docs/context.html#reactcreatecontext
|
|
43
|
+
const CounterContext = createContext<CounterContextValue>({});
|
|
44
|
+
|
|
45
|
+
const CounterProvider = CounterContext.Provider;
|
|
46
|
+
|
|
47
|
+
// not necessary but can be a good layer to mock for unit testing
|
|
48
|
+
const useCounterContext = <T>(selector: ContextSelector<CounterCountext, T>) =>
|
|
49
|
+
useContextSelector(CounterContext, selector);
|
|
50
|
+
|
|
51
|
+
const Counter1 = () => {
|
|
52
|
+
// 💡 Context updates will be propagated only when result of a selector function will change
|
|
53
|
+
// "Object.is()" is used for internal comparisons
|
|
54
|
+
const count1 = useCounterContext(context => context.count1);
|
|
55
|
+
const increment = useCounterContext(context => context.incrementCount1);
|
|
56
|
+
|
|
57
|
+
return <button onClick={increment}>Counter 1: {count1}</button>;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const Counter2 = () => {
|
|
61
|
+
const count1 = useCounterContext(context => context.count2);
|
|
62
|
+
const increment = useCounterContext(context => context.incrementCount2);
|
|
63
|
+
|
|
64
|
+
return <button onClick={increment}>Counter 1: {count1}</button>;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default function App() {
|
|
68
|
+
const [state, setState] = React.useState({ count1: 0, count2: 0 });
|
|
69
|
+
|
|
70
|
+
const incrementCount1 = React.useCallback(() => setState(s => ({ ...s, count1: s.count1 + 1 })), [setState]);
|
|
71
|
+
const incrementCount2 = React.useCallback(() => setState(s => ({ ...s, count2: s.count2 + 1 })), [setState]);
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<div className="App">
|
|
75
|
+
<CounterProvider
|
|
76
|
+
value={{
|
|
77
|
+
count1: state.count1,
|
|
78
|
+
count2: state.count2,
|
|
79
|
+
incrementCount1,
|
|
80
|
+
incrementCount2,
|
|
81
|
+
}}
|
|
82
|
+
>
|
|
83
|
+
<Counter1 />
|
|
84
|
+
<Counter2 />
|
|
85
|
+
</CounterProvider>
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### useHasParentContext
|
|
92
|
+
|
|
93
|
+
This helper hook will allow you to know if a component is wrapped by a context selector provider
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
const Foo = () => {
|
|
97
|
+
// An easy way to test if a context provider is wrapped around this component
|
|
98
|
+
// since it's more complicated to compare with a default context value
|
|
99
|
+
const isWrappedWithContext = useHasParentContext(CounterContext);
|
|
100
|
+
|
|
101
|
+
if (isWrappedWithContext) {
|
|
102
|
+
return <div>I am inside context selector provider</div>;
|
|
103
|
+
} else {
|
|
104
|
+
return <div>I can only use default context value</div>;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Technical memo
|
|
110
|
+
|
|
111
|
+
React context by nature triggers propagation of component re-rendering if a value is changed. To avoid this, this library uses undocumented feature of `calculateChangedBits`. It then uses a subscription model to force update when a component needs to re-render.
|
|
112
|
+
|
|
113
|
+
## Limitations
|
|
114
|
+
|
|
115
|
+
- In order to stop propagation, `children` of a context provider has to be either created outside of the provider or memoized with `React.memo`.
|
|
116
|
+
- `<Consumer />` components are not supported.
|
|
117
|
+
- The [stale props](https://react-redux.js.org/api/hooks#stale-props-and-zombie-children) issue can't be solved in userland. (workaround with try-catch)
|
|
118
|
+
|
|
119
|
+
## Related projects
|
|
120
|
+
|
|
121
|
+
The implementation is heavily inspired by:
|
|
122
|
+
|
|
123
|
+
- [use-context-selector](https://github.com/dai-shi/use-context-selector)
|
|
124
|
+
- [react-tracked](https://github.com/dai-shi/react-tracked)
|