diff --git a/change/@fluentui-react-context-selector-9fd104eb-e78f-4838-b618-89b8dc540956.json b/change/@fluentui-react-context-selector-9fd104eb-e78f-4838-b618-89b8dc540956.json new file mode 100644 index 0000000000000..398ed11cde85b --- /dev/null +++ b/change/@fluentui-react-context-selector-9fd104eb-e78f-4838-b618-89b8dc540956.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "docs: removed the mention of non-existent useContextSelectors and fixed the example", + "packageName": "@fluentui/react-context-selector", + "email": "gk.joker@gmail.com", + "dependentChangeType": "patch" +} diff --git a/packages/react-components/react-context-selector/README.md b/packages/react-components/react-context-selector/README.md index 6e0b0c08ac5de..0db9398e74963 100644 --- a/packages/react-components/react-context-selector/README.md +++ b/packages/react-components/react-context-selector/README.md @@ -1,6 +1,6 @@ # `@fluentui/react-context-selector` -React `useContextSelector()` and `useContextSelectors()` hooks in userland. +React `useContextSelector()` hook in userland. ## Introduction @@ -40,12 +40,12 @@ interface CounterContextValue { // 💡 The same syntax as native React context API // https://reactjs.org/docs/context.html#reactcreatecontext -const CounterContext = createContext({}); +const CounterContext = createContext({} as CounterContextValue); const CounterProvider = CounterContext.Provider; // not necessary but can be a good layer to mock for unit testing -const useCounterContext = (selector: ContextSelector) => +const useCounterContext = (selector: ContextSelector) => useContextSelector(CounterContext, selector); const Counter1 = () => { @@ -58,10 +58,10 @@ const Counter1 = () => { }; const Counter2 = () => { - const count1 = useCounterContext(context => context.count2); + const count2 = useCounterContext(context => context.count2); const increment = useCounterContext(context => context.incrementCount2); - return ; + return ; }; export default function App() {