1.0.2 • Published 8 years ago

react-default-props v1.0.2

Weekly downloads
17
License
MIT
Repository
github
Last release
8 years ago

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') ]
});