@fluentui/react-context-selector 0.0.0-nightly-20241028-0410.1 → 0.0.0-nightly-20241030-0406.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.md +5 -5
- package/README.md +5 -5
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-context-selector
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 30 Oct 2024 04:11:15 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## [0.0.0-nightly-
|
|
7
|
+
## [0.0.0-nightly-20241030-0406.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v0.0.0-nightly-20241030-0406.1)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.1.68..@fluentui/react-context-selector_v0.0.0-nightly-
|
|
9
|
+
Wed, 30 Oct 2024 04:11:15 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.1.68..@fluentui/react-context-selector_v0.0.0-nightly-20241030-0406.1)
|
|
11
11
|
|
|
12
12
|
### Changes
|
|
13
13
|
|
|
14
14
|
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
|
|
15
|
-
- Bump @fluentui/react-utilities to v0.0.0-nightly-
|
|
15
|
+
- Bump @fluentui/react-utilities to v0.0.0-nightly-20241030-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/3b037a58cfd15f9328202bddaf0dc94fc5be7265) by beachball)
|
|
16
16
|
|
|
17
17
|
## [9.1.68](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.1.68)
|
|
18
18
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# `@fluentui/react-context-selector`
|
|
2
2
|
|
|
3
|
-
React `useContextSelector()`
|
|
3
|
+
React `useContextSelector()` hook in userland.
|
|
4
4
|
|
|
5
5
|
## Introduction
|
|
6
6
|
|
|
@@ -40,12 +40,12 @@ interface CounterContextValue {
|
|
|
40
40
|
|
|
41
41
|
// 💡 The same syntax as native React context API
|
|
42
42
|
// https://reactjs.org/docs/context.html#reactcreatecontext
|
|
43
|
-
const CounterContext = createContext<CounterContextValue>({});
|
|
43
|
+
const CounterContext = createContext<CounterContextValue>({} as CounterContextValue);
|
|
44
44
|
|
|
45
45
|
const CounterProvider = CounterContext.Provider;
|
|
46
46
|
|
|
47
47
|
// not necessary but can be a good layer to mock for unit testing
|
|
48
|
-
const useCounterContext = <T
|
|
48
|
+
const useCounterContext = <T,>(selector: ContextSelector<CounterContextValue, T>) =>
|
|
49
49
|
useContextSelector(CounterContext, selector);
|
|
50
50
|
|
|
51
51
|
const Counter1 = () => {
|
|
@@ -58,10 +58,10 @@ const Counter1 = () => {
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
const Counter2 = () => {
|
|
61
|
-
const
|
|
61
|
+
const count2 = useCounterContext(context => context.count2);
|
|
62
62
|
const increment = useCounterContext(context => context.incrementCount2);
|
|
63
63
|
|
|
64
|
-
return <button onClick={increment}>Counter
|
|
64
|
+
return <button onClick={increment}>Counter 2: {count2}</button>;
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
export default function App() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-context-selector",
|
|
3
|
-
"version": "0.0.0-nightly-
|
|
3
|
+
"version": "0.0.0-nightly-20241030-0406.1",
|
|
4
4
|
"description": "React useContextSelector hook in userland",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@fluentui/scripts-tasks": "*"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@fluentui/react-utilities": "0.0.0-nightly-
|
|
31
|
+
"@fluentui/react-utilities": "0.0.0-nightly-20241030-0406.1",
|
|
32
32
|
"@swc/helpers": "^0.5.1"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|