Created
December 5, 2017 23:05
-
-
Save fresh5447/cb776b2a939f77d5be46282d61193499 to your computer and use it in GitHub Desktop.
declarative-react-decorator-transitions withState
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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