Skip to content

Instantly share code, notes, and snippets.

@searleb
Created August 10, 2017 02:35
Show Gist options
  • Save searleb/29f21da26da6fa43fc13e64f7ad295e1 to your computer and use it in GitHub Desktop.
Save searleb/29f21da26da6fa43fc13e64f7ad295e1 to your computer and use it in GitHub Desktop.
IfDevelopment: React Component
import PropTypes from 'prop-types'
/**
* Takes a render prop which will render if we are in development environment
* @method IfDevelopment
* @param {Func} render callback function to render JSX
*/
const IfDevelopment = ({ render }) => (
process.env.NODE_ENV === 'development' ? render() : null
)
IfDevelopment.propTypes = {
render: PropTypes.func.isRequired,
}
export default IfDevelopment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment