Skip to content

elierotenberg/react-maybe-state

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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>;
}

About

React Mixin for maybe getting state (defaulting to null).

Resources

Stars

Watchers

Forks

Packages

No packages published