React lifecycle as components
An alternative to writing classes, here are some declarative components you can use to keep your code clean 👌🏻
Supports: React DOM and React Native.
Install
yarn install react-lifecycle-components
Components
Mount
When you want to perform a side-effect on mount, like sending a tracking event 🚀, starting an animation ✨, or something like that.
<Mount on= console />
Unmount
Basically the same as Mount
but calls on
when the component will unmount 😄
<Unmount on= console />
Update
When you want to be notified when a prop was changed. 👌🏻 Works with both non-objects (simple equality check) or with objects (shallow equality check).
<Update<string> was= console watched="hello" /> interface AnObject anObject: string; <Update<AnObject> was= console watched= anObject: "hello" />