Skip to content

Instantly share code, notes, and snippets.

@casesandberg
Created February 17, 2017 19:17
Show Gist options
  • Save casesandberg/71f91900fb3e6fd0b5f10ccf571af3d2 to your computer and use it in GitHub Desktop.
Save casesandberg/71f91900fb3e6fd0b5f10ccf571af3d2 to your computer and use it in GitHub Desktop.
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