Beginner
A Button with variants and native props
Finish the Button component so it accepts **every native <button> prop** plus a variant of "primary" or "danger" (default "primary").
Type it with ComponentProps<"button"> joined to your own props, and spread the remaining props onto the real <button>.
The rendered button's class must be btn btn-primary or btn btn-danger. The Add button (id="add") increases the number in id="count"; the Reset button (id="reset") is a danger button that sets it back to 0; the Locked button (id="locked") is disabled.
What Check tests
- The three buttons have ids add, reset and locked
- Classes are btn btn-primary and btn btn-danger
- Clicking Add twice shows 2
- Reset sets the count back to 0
- The Locked button is disabled
- Props are typed with ComponentProps<"button"> and a variant union
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Your page
Press Run to see the page.
Console
Nothing logged yet.