Created
October 25, 2017 13:29
-
-
Save alvincrespo/d7d8ce82138763a1c14a25f5eb77634b to your computer and use it in GitHub Desktop.
Functions as children component composition
This file contains hidden or 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
const PasswordField = (props) => { | |
let children = { | |
label: <label>Password</label>, | |
input: <input type="password" /> | |
}; | |
if (props.children) { | |
return props.children(children); | |
} | |
return ( | |
<Field> | |
{children.label} | |
{children.input} | |
</Field> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment