npm i merge-props-utils
Pass in one or multiple objects
import mergeProps from 'merge-props-utils'
function App() {
const props = {
one: "one",
two: "two"
}
const merged = mergeProps(
props,
{
onClick: event => {…},
onFocus: event => {…},
className: "some-className"
},
{ "data-testid": "some-testid" }
)
return <button {...merged}>Click me!</button>
}