Skip to content

Latest commit

 

History

History
24 lines (15 loc) · 516 Bytes

hoc-generator.md

File metadata and controls

24 lines (15 loc) · 516 Bytes

hoc()() Higher Order Component Interface

The hoc()() function creates HOCs that can style HTML elements.

Usage

First import hoc().

import hoc from 'freestyler/lib/react/hoc';

Now let's create a HOC that will add orange border to HTML elements.

const withOrangeBorder = hoc({
    border: '1px solid orange'
});

const DivWithRedBorder = withOrangeBorder('div');

<DivWithRedBorder>Hello world</DivWithRedBorder>