@wordpress/compose
Version:
WordPress higher-order components (HOCs).
28 lines (19 loc) • 453 B
Markdown
Hook used to focus the first tabbable element on mount.
- Type: `Object|Function`
A React ref that must be passed to the DOM element where the behavior should be attached.
```jsx
import { useFocusOnMount } from '@wordpress/compose';
const WithFocusOnMount = () => {
const ref = useFocusOnMount();
return (
<div ref={ ref }>
<Button />
<Button />
</div>
);
};
```