Skip to content

simple proof of concept for a hover higher order component

Notifications You must be signed in to change notification settings

marknach/hoverhoc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HoverHOC

Used for dynamic prop switching for a component on hover

Usage

HoverHOC takes two sets of props, one supplied to the child component on hover, and another for the default props

(contrived example)

const Label = React.createClass({
    render() {
        return (
            <div {...this.props}>
                {this.props.children}{this.props.suffix}
            </div>
        );
    }
});

render(
    <HoverHOC
        default={{}}
        hovered={{suffix: '!'}}
    >
        <Label>Hello, World</Label>
    </HoverHOC>,
    document.getElementById('root')
);

About

simple proof of concept for a hover higher order component

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published