Skip to content

Instantly share code, notes, and snippets.

@fresh5447
Created December 5, 2017 23:05
Show Gist options
  • Select an option

  • Save fresh5447/cb776b2a939f77d5be46282d61193499 to your computer and use it in GitHub Desktop.

Select an option

Save fresh5447/cb776b2a939f77d5be46282d61193499 to your computer and use it in GitHub Desktop.
declarative-react-decorator-transitions withState
import { compose, withHandlers, withState } from 'recompose';
const App = ({toggleBox, toggleBox2, showingBox, showingBox2}) =>
<div className="App">
<h1>Declarative Decorator Transitions</h1>
<button onClick={() => toggleBox((toggleBox) => !toggleBox)}>TOGGLE BOX</button>
<button onClick={() => toggleBox2((toggleBox2) => !toggleBox2)}>TOGGLE BOX 2</button>
<Box animationTrigger={showingBox} />
<Box2 animationTrigger={showingBox2} />
</div>
const enhance = compose(
withState('showingBox', 'toggleBox', true),
withState('showingBox2', 'toggleBox2', true),
);
export default enhance(App)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment