react-default-props
v1.0.2
Published
A helper function to return a new react component with default props
Downloads
10
Maintainers
Readme
react-default-props
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') ]
});