From 3760c39c2081168e2cc05b09ed568f954a60a289 Mon Sep 17 00:00:00 2001
From: Carlos Meira <37943747+caumeira@users.noreply.github.com>
Date: Sun, 21 Aug 2022 16:47:10 -0300
Subject: [PATCH] Update hook name in README (#41)
The hook name in readme is apparently wrong.
---
README.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 6304b1c..955a7e7 100644
--- a/README.md
+++ b/README.md
@@ -222,14 +222,14 @@ const [loading, setLoading] = React.useState(false)
return {loading && Hang on…}
```
-### `useCmdk(state => state.selectedField)`
+### `useCommandState(state => state.selectedField)`
Hook that composes [`useSyncExternalStore`](https://reactjs.org/docs/hooks-reference.html#usesyncexternalstore). Pass a function that returns a slice of the command menu state to re-render when that slice changes. This hook is provided for advanced use cases and should not be commonly used.
A good use case would be to render a more detailed empty state, like so:
```tsx
-const search = useCmdk((state) => state.search)
+const search = useCommandState((state) => state.search)
return No results found for "{search}".
```
@@ -292,7 +292,7 @@ If your items have nested sub-items that you only want to reveal when searching,
```tsx
const SubItem = (props) => {
- const search = useCmdk((state) => state.search)
+ const search = useCommandState((state) => state.search)
if (!search) return null
return
}