Skip to content

Instantly share code, notes, and snippets.

View brudil's full-sized avatar
🦋
making things better

James Canning brudil

🦋
making things better
View GitHub Profile
@brudil
brudil / ConditionalWrap.tsx
Last active April 23, 2018 21:26 — forked from kitze/conditionalwrap.js
one-line React component for conditionally wrapping children
interface IProps {
condition: boolean;
wrap(wrapper: (children: any) => any): any;
children: any;
}
export const ConditionalWrap = ({ condition, wrap, children }: IProps) =>
condition ? wrap(children) : children;