Skip to content

Johannesklint/merge-props-util

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation

npm i merge-props-utils

Usage

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>
}