-
-
Save hharnisc/d591549a186232a337535de2ba9ccf30 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, { PropTypes } from 'react'; | |
import { Hoverable } from '@bufferapp/redux-hover'; | |
const MyComponent = ({ | |
hovered, // managed by redux-hover | |
onMouseEnter, | |
onMouseLeave, | |
}) => | |
<div | |
onMouseEnter={onMouseEnter} | |
onMouseLeave={onMouseLeave} | |
style={{ background: hovered ? 'green' : 'red' }} | |
> | |
Hover This | |
</div>; | |
MyComponent.propTypes = { | |
hovered: PropTypes.bool, | |
onMouseEnter: PropTypes.func, | |
onMouseLeave: PropTypes.func, | |
}; | |
// wrap the export like a container does | |
export default Hoverable(MyComponent); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment