Created
August 10, 2017 02:35
-
-
Save searleb/29f21da26da6fa43fc13e64f7ad295e1 to your computer and use it in GitHub Desktop.
IfDevelopment: React Component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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