Skip to content

Instantly share code, notes, and snippets.

View vincentmvdm's full-sized avatar

Vincent M. van der Meulen vincentmvdm

View GitHub Profile
import React from 'react';
import styled, { css } from 'styled-components';
import { Tooltip } from '../globals';
export const InlineSvg = styled.svg`
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
@kitze
kitze / conditionalwrap.js
Created October 25, 2017 16:54
one-line React component for conditionally wrapping children
import React from 'react';
const ConditionalWrap = ({condition, wrap, children}) => condition ? wrap(children) : children;
const Header = ({shouldLinkToHome}) => (
<div>
<ConditionalWrap
condition={shouldLinkToHome}
wrap={children => <a href="/">{children}</a>}
>