Permalink
Fetching contributors…
Cannot retrieve contributors at this time
27 lines (20 sloc) 440 Bytes

createLifecycleEvents()

Create life-cycles for component tree.

Usage

import {createLifecycleEvents} from 'libreact/lib/shim';

const Lifecycles = createLifecycleEvents({
  didMount: ({foo}) => {
    console.log('Tree did mount!');
    console.log(`"foo" is "${foo}.`);
  },
  willUnmount: () => {
    console.log('Tree will un-mount!');
  },
});

<Lifecycles foo='bar'>
  <div>
    Hello world!
  </div>
</Lifecycles>