React Component ... Component
What?
Declarative version of React.Component.
Why?
Because sometimes you want a lifecycle or some state but don't want to create a new component. Also, this stuff is composable as heck.
Installation
And then import it:
Or use script tags and globals.
And then grab it off the global like so:
How?
Let's say you want some async data but don't want to make a whole new component just for the lifecycles to get it:
Or maybe you need a little bit of state but an entire component
seems a bit heavy:
Props
You know all of these already:
didMount({ state, setState, props, forceUpdate })
shouldUpdate({ state, props, nextProps, nextState })
didUpdate({ state, setState, props, forceUpdate, prevProps, prevState })
willUnmount({ state, props })
children({ state, setState, props, forceUpdate })
render({ state, setState, props, forceUpdate })