scrimba
Frontend Career Path
Advanced React
Reusability
Button - size prop
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

AboutCommentsNotes
Button - size prop
Expand for more info
Button.js
run
preview
console
import React from "react"

export default function Button({children, ...rest}) {
/**
* Challenge: accept the `size` prop and set the `className` of the
* <button> to:
*
* "button-small" if `size` is "sm"
* "button-large" if `size` is "lg"
*
* Note: don't try to manually add a `className` to the Button
* instance in index.js yet. (DO add `className` to this file
* as part of the challenge, though.)
*/

return (
<button {...rest}>
{children}
</button>
)
}
Console
/index.html
-5:16