Beginner
A Button wrapper with defaults and rest props
Rewrite Button so it takes a variant prop that defaults to "primary", plus children, and collects every other prop with ...rest.
It must render a real <button> whose className is btn btn-<variant> (for example btn btn-danger) and spread the rest props onto it, so id, onClick, disabled and any other attribute just work.
Don't change App: it already uses Button the way a real app would. When it works, clicking Save shows Saved! in the paragraph #msg.
What Check tests
- Save has the classes
btn btn-primary(the default variant) - Delete has
btn-dangerand keeps itstitle - Undo is disabled and has
btn-ghost - Clicking Save shows
Saved! variantis never written onto the DOM
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.