Spread Attributes

Example of spreading all attributes

<Greeting firstName='Michael' lastName='Burhman' />
const person = {
firstName: 'Michael',
lastName: 'Burhman'
}
<Greeting {...person} />

Example of picking specific props and passing the the rest

const Button = props => {
const { kind, ...other } = props
const className = kind === "primary" ? "PrimaryButton" : "SecondaryButton"
return <button className={className} {...other} />
}
const App = () => {
return (
<div>
<Button kind="primary" onClick={() => console.log("clicked!")}>
Hello World!
</Button>
</div>
)
}

Source -> JSX Spread Attributes