UNPKG

react-conditional-rendering

Version:

A React component library that helps in conditional rendering.

10 lines (7 loc) 315 B
import React, { Fragment } from 'react'; // Components are functions, and they must start with a capital letter function RenderComponent({ component, condition }) { return condition && <Fragment> {component()}</Fragment>; } // This export will be picked up in ./index.js export default RenderComponent;