Skip to content

Instantly share code, notes, and snippets.

@nesbtesh
Last active November 20, 2016 00:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nesbtesh/72d4896a20d89f2ebbaa7e8171641476 to your computer and use it in GitHub Desktop.
Save nesbtesh/72d4896a20d89f2ebbaa7e8171641476 to your computer and use it in GitHub Desktop.
React render if true
'use strict';
const isFunction = input => typeof input === 'function';
export default predicate => elemOrThunk =>
predicate ? (isFunction(elemOrThunk) ? elemOrThunk() : elemOrThunk) : null;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment