useFocus ​
Hook that allows you to focus on a specific element
typescript
import { useFocus } from '@siberiacancode/reactuse';
Usage ​
typescript
const { focus, blur, focused } = useFocus(target);
Demo ​
Api ​
Parameters
Name | Type | Default | Note |
---|---|---|---|
target | Target | - | The target element to focus |
options.initialFocus? | boolean | false | The initial focus state of the target |
Returns
Parameters
Name | Type | Default | Note |
---|---|---|---|
options.initialFocus? | boolean | false | The initial focus state of the target |