The hoc()()
function creates HOCs that can style HTML elements.
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>