react.mixer
External mixins (traits) for react components.
Installation
npm install --save react.mixer
Usage
New component
; // plain old react-component implementation ;
And then:
// Usage place; const DefaultedMyAwesomeComponent = MyAwesomeComponent;
Existing component
;; let id = 0;const Input = ;
Creating custom mixin
// in place import custom from 'react.mixer'; { /* code */ }const MyAwesomeMixableComponentWithOnStart = MyAwesomeMixableComponent; // as class import Mixin from 'react.mixer/lib/mixins/Mixin'; { ; } { // IMPORTANT: Parameter with "Component" MUST be named in TitleCase, otherwise jsx would ignore it!!! return <Component > instancechildren <p>Hello!</p> </Component> ; } // and then just mix it in const MyAwesomeMixableComponentWithHello = MyAwesomeMixableComponent;
License
This library is licensed under MIT license.