react-default-props

1.0.2 • Public • Published

react-default-props

Build Status npm version

A helper function to return a new react component from an existing react component with a new set of default props

Install

npm install --save react-default-props

Signature

This function has two parameters

component

The React Component for which the default props should be modified.

defaultProps

The defaults that should be overridden as an object

Example Usage

var rdp = require('react-default-props');
var ReactDOM = require('react-dom');
var myComp = require('./MyComponent');
var myCompWithNewDefaults = rdp(myComp, {
    someDefaultProp: 'red',
    children: [ React.DOM.span({}, 'test') ]
});

Package Sidebar

Install

npm i react-default-props

Weekly Downloads

7

Version

1.0.2

License

MIT

Last publish

Collaborators

  • moodysalem