react-maybe-state

React Maybe State =================

Usage no npm install needed!

<script type="module">
  import reactMaybeState from 'https://cdn.skypack.dev/react-maybe-state';
</script>

README

React Maybe State

Kind of like the Maybe monad but for state values. No more (this.state.foo ? (this.state.foo.bar ? f(this.state.foo.bar) : null) : null) boilerplate.

Example
render() {
  return <div>My name this {this.maybeState('identity', 'firstName')} {this.maybeState('identity', 'lastName')}.</div>;
}