@fluentui/react-context-selector
Advanced tools
Comparing version 0.0.0-nightly-20241029-0406.1 to 0.0.0-nightly-20241030-0406.1
# Change Log - @fluentui/react-context-selector | ||
This log was last generated on Tue, 29 Oct 2024 04:11:19 GMT and should not be manually modified. | ||
This log was last generated on Wed, 30 Oct 2024 04:11:15 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## [0.0.0-nightly-20241029-0406.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v0.0.0-nightly-20241029-0406.1) | ||
## [0.0.0-nightly-20241030-0406.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v0.0.0-nightly-20241030-0406.1) | ||
Tue, 29 Oct 2024 04:11:19 GMT | ||
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-context-selector_v9.1.68..@fluentui/react-context-selector_v0.0.0-nightly-20241029-0406.1) | ||
Wed, 30 Oct 2024 04:11:15 GMT | ||
[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) | ||
@@ -15,3 +15,3 @@ ### Changes | ||
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com) | ||
- Bump @fluentui/react-utilities to v0.0.0-nightly-20241029-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/4ad6cff3a29abf29cc2ed98241bd31e5e2481564) by beachball) | ||
- Bump @fluentui/react-utilities to v0.0.0-nightly-20241030-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/3b037a58cfd15f9328202bddaf0dc94fc5be7265) by beachball) | ||
@@ -18,0 +18,0 @@ ## [9.1.68](https://github.com/microsoft/fluentui/tree/@fluentui/react-context-selector_v9.1.68) |
{ | ||
"name": "@fluentui/react-context-selector", | ||
"version": "0.0.0-nightly-20241029-0406.1", | ||
"version": "0.0.0-nightly-20241030-0406.1", | ||
"description": "React useContextSelector hook in userland", | ||
@@ -31,3 +31,3 @@ "main": "lib-commonjs/index.js", | ||
"dependencies": { | ||
"@fluentui/react-utilities": "0.0.0-nightly-20241029-0406.1", | ||
"@fluentui/react-utilities": "0.0.0-nightly-20241030-0406.1", | ||
"@swc/helpers": "^0.5.1" | ||
@@ -34,0 +34,0 @@ }, |
# `@fluentui/react-context-selector` | ||
React `useContextSelector()` and `useContextSelectors()` hooks in userland. | ||
React `useContextSelector()` hook in userland. | ||
@@ -43,3 +43,3 @@ ## Introduction | ||
// https://reactjs.org/docs/context.html#reactcreatecontext | ||
const CounterContext = createContext<CounterContextValue>({}); | ||
const CounterContext = createContext<CounterContextValue>({} as CounterContextValue); | ||
@@ -49,3 +49,3 @@ const CounterProvider = CounterContext.Provider; | ||
// not necessary but can be a good layer to mock for unit testing | ||
const useCounterContext = <T>(selector: ContextSelector<CounterContextValue, T>) => | ||
const useCounterContext = <T,>(selector: ContextSelector<CounterContextValue, T>) => | ||
useContextSelector(CounterContext, selector); | ||
@@ -63,6 +63,6 @@ | ||
const Counter2 = () => { | ||
const count1 = useCounterContext(context => context.count2); | ||
const count2 = useCounterContext(context => context.count2); | ||
const increment = useCounterContext(context => context.incrementCount2); | ||
return <button onClick={increment}>Counter 1: {count1}</button>; | ||
return <button onClick={increment}>Counter 2: {count2}</button>; | ||
}; | ||
@@ -69,0 +69,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
105889
+ Added@fluentui/keyboard-keys@0.0.0-nightly-20241030-0406.1(transitive)
+ Added@fluentui/react-shared-contexts@0.0.0-nightly-20241030-0406.1(transitive)
+ Added@fluentui/react-theme@0.0.0-nightly-20241030-0406.1(transitive)
+ Added@fluentui/react-utilities@0.0.0-nightly-20241030-0406.1(transitive)
+ Added@fluentui/tokens@0.0.0-nightly-20241030-0406.1(transitive)
- Removed@fluentui/keyboard-keys@0.0.0-nightly-20241029-0406.1(transitive)
- Removed@fluentui/react-shared-contexts@0.0.0-nightly-20241029-0406.1(transitive)
- Removed@fluentui/react-theme@0.0.0-nightly-20241029-0406.1(transitive)
- Removed@fluentui/react-utilities@0.0.0-nightly-20241029-0406.1(transitive)
- Removed@fluentui/tokens@0.0.0-nightly-20241029-0406.1(transitive)
Updated@fluentui/react-utilities@0.0.0-nightly-20241030-0406.1