diff --git a/README.md b/README.md index 710870e42..584e15ee8 100644 --- a/README.md +++ b/README.md @@ -353,7 +353,7 @@ Scroll controls create a HTML scroll container in front of the canvas. Everythin You can listen and react to scroll with the `useScroll` hook which gives you useful data like the current scroll `offset`, `delta` and functions for range finding: `range`, `curve` and `visible`. The latter functions are especially useful if you want to react to the scroll offset, for instance if you wanted to fade things in and out if they are in or out of view. ```jsx - } -export function useKeyboardControls(): [ +type Selector = (state: KeyboardControlsState) => boolean + +export function useKeyboardControls(): [ Subscribe>, GetState> ] -export function useKeyboardControls( - sel: StateSelector, U> -): U -export function useKeyboardControls( - sel?: StateSelector, U> -): U | [Subscribe>, GetState>] { +export function useKeyboardControls(sel: Selector): ReturnType> +export function useKeyboardControls( + sel?: Selector +): ReturnType> | [Subscribe>, GetState>] { const [sub, get, store] = React.useContext>(context) if (sel) return store(sel) else return [sub, get]