0.0.4 • Published 9 years ago

react-wrapchildren v0.0.4

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

Wrap children

Install

npm install --save react-wrapchildren

Demo

npm run dev then visit http://127.0.0.1:3000

Why ?

Sometimes you would like to put an intermediate component before a component renders its children, e.g. to insert the Animate component around another component's children.

Usage

import MyComponent from './MyComponent';
import Animate from 'rc-animate';
import wrapChildren from 'react-wrapchildren';

const WrappedComponent = wrapChildren(MyComponent);

<WrappedComponent something={ 'Any prop for MyComponent' } wrapper={ <Animate transitionName='fade'/> }/>

If the render function of MyComponent renders this :

<div>
  <span/>
  <span/>
  <span/>
</div>

It will return instead :

<div>
  <Animate>
    <span/>
    <span/>
    <span/>
  </Animate>
</div>
0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago