Last active
June 23, 2021 03:08
-
-
Save diego3g/36dbeb89724a94ccc86b5e9952f34ee7 to your computer and use it in GitHub Desktop.
This file contains 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 React from 'react'; | |
import { compose, withState, withHandlers } from 'recompose'; | |
const Dropdown = ({ opened, toggleDropdown }) => ( | |
<div> | |
<button type="button" onClick={toggleDropdown}> | |
Abrir/fechar | |
</button> | |
<ul className={`dropdown ${opened ? 'dropdown-open' : ''}`}> | |
<li>ReactJS</li> | |
<li>React Native</li> | |
<li>NodeJS</li> | |
</ul> | |
</div> | |
); | |
export default compose( | |
withState('opened', 'setOpened', false), | |
withHandlers({ | |
toggleDropdown: (props) => { | |
props.setOpened(!props.opened); | |
}, | |
}), | |
)(Dropdown); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment