Created
February 17, 2017 19:17
-
-
Save casesandberg/71f91900fb3e6fd0b5f10ccf571af3d2 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(TestComponent); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment