1.0.3 • Published 6 months ago

react-merge-props v1.0.3

Weekly downloads
10
License
MIT
Repository
github
Last release
6 months ago

react-merge-props

NPM version Build Status Test Coverage License PR Welcome

Deep props merging functionality for React.

Introduction

Merging react component props by the following rule:

  1. Normal props replace the former
  2. className are concatenated
  3. style are shallow merged
  4. functions are run in sequence from left to right

When creating extensible react components, this is what we need.

Installation

Install this package with npm.

npm i react-merge-props -s

Usage Pattern

This package is very useful when creating wrapping components. For example:

import React from 'react';
import mergeProps from 'react-merge-props';

const HeadingOne = (props) => (
  <h1 {...mergeProps({ style: { 'color': 'red' }}, props)} />
);

export default HeadingOne;

License

MIT © Victor Teo

1.0.2

6 months ago

1.0.0

6 months ago

1.0.0-alpha.0

6 months ago

1.0.3

6 months ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.0.1

6 years ago