Skip to content
This repository was archived by the owner on May 5, 2023. It is now read-only.
This repository was archived by the owner on May 5, 2023. It is now read-only.

Create React hook (e.g useFocusable) that compliments the existing HOC. #77

Closed
@TrebuhD

Description

@TrebuhD

Is your feature request related to a problem? Please describe.
Hooks were introduced 2 years ago in React 16.8. With class-based components decreasing in popularity compared to functional components, it would make sense to create a hook as an alternative to the withFocusable HOC.

Describe the solution you'd like
The hook could work like this:

const { focused, setFocus, stealFocus } = useFocusable({ 
  trackChildren: true,
  forgetLastFocusedChild: true,
});

Additional context
This is highly desireable, since many projects are not using HOCs anymore. In our project, withFocusable is the last remaining HOC.

Please let me know if you'd like help with this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions