import React, { Component } from 'react'; interface RequiredProps { condition: boolean; conditionalProps: { [key: string]: any; }; } /** * Optional */ export const withConditional = ( PassedComponent: React.ComponentType ) => class extends Component { public render() { const { condition, conditionalProps, ...passedProps } = this.props as any; return condition ? ( ) : ( ); } };