项目作者: hamlim

项目描述 :
React lifecycle render-prop components ♻️
高级语言: JavaScript
项目地址: git://github.com/hamlim/recycles.git
创建时间: 2018-03-31T23:43:18Z
项目社区:https://github.com/hamlim/recycles

开源协议:

下载


Recycles ♻️

Recycles is a simple React render-prop component library providing access to several React component lifecycle methods.

All of the exported components accept an optional callback prop and a children prop. Both of these are functions, and the components will return null if callback is undefined, otherwise they return this.props.children().

Example:

  1. import { ComponentDidMount } from 'recycles'
  2. render(
  3. <Fragment>
  4. <ComponentDidMount>
  5. {() => {
  6. // if your app was server side rendered, this only gets evaluated on the client
  7. window.startTrackingOrSomething()
  8. }}
  9. </ComponentDidMount>
  10. <App ></App>
  11. </Fragment>,
  12. )