Skip to content

Instantly share code, notes, and snippets.

@steelydylan
Created February 6, 2019 08:16
Show Gist options
  • Save steelydylan/1be5a0878d646488c2c01565eec7b91b to your computer and use it in GitHub Desktop.
Save steelydylan/1be5a0878d646488c2c01565eec7b91b to your computer and use it in GitHub Desktop.
ConditionalWrapComponent
import * as React from 'react';
interface ConditionalWrapType{
condition: boolean,
wrap: (children) => React.ReactNode
children: React.ReactNode
}
export default ({condition, wrap, children}): React.SFCElement<ConditionalWrapType> => condition ? wrap(children) : children;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment