Created
December 6, 2016 05:27
-
-
Save joarhal/8c858e9e1166a2009352f71923e45f95 to your computer and use it in GitHub Desktop.
If component for react
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 React from 'react'; | |
const If = ({style={}, className='', condition, children}) => { | |
if (condition) | |
return (<div className={className} style={Object.assign({}, style)}>{children}</div>) | |
else | |
return null | |
} | |
export default If |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment