Skip to content

Latest commit

 

History

History
26 lines (20 loc) · 440 Bytes

createLifecycleEvents.md

File metadata and controls

26 lines (20 loc) · 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>