Click in order · JavaScript and React course · Module 15: Patterns and Architecture
Steps to Create a Headless Component
Click the steps for creating a headless component in order:
Items to click
- In the visual component, call the hook and take getProps from it.
- Spread the result of getProps on the JSX elements of that component.
- Add getProps methods returning aria attributes and handlers to the hook.
- Extract the logic (state, handlers) into a custom hook.
You can check the correct answer by solving this task in the CodeWorlds game.