Skip to content

Latest commit

 

History

History
36 lines (30 loc) · 569 Bytes

renderComponent.md

File metadata and controls

36 lines (30 loc) · 569 Bytes

renderComponent

Description

Takes a component and returns a higher-order component version of that component.

This is useful in combination with another helper that expects a higher-order component, like branch():

API

renderComponent(
  Component : Function
) : Function

Example

import {
  branch,
  compose,
  renderComponent,
} from 'incompose';

const A = () => (
  <h1>a</h1>
);

const B = () => (
  <h2>loading...</h2>
);

export default compose(
  branch(
    (props) => props.value % 2 === 0,
    renderComponent(B),
  )
)(A);