Created
October 4, 2019 16:29
-
-
Save ryanflorence/9a5bd177832588bbb94f8541cf02b9a4 to your computer and use it in GitHub Desktop.
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
// #1 | |
// can pass by name | |
<Button children={el2} /> | |
const el = React.createElement(Button, { children: el2 }) | |
// or by position | |
<Button>{el2}</Button> | |
const el = React.createElement(Button, null, el2) | |
// React theoretically turns it into this once you're in the component: | |
const el = React.createElement(Button, { children: el2 }) | |
// #2 it flattens multiple children into an array | |
<Button> | |
<span/> | |
{stuff.map(() => <span/>)} | |
<span/> | |
</Button> | |
const el = React.createElement(Button, null, el2, [el3, el4], el5) | |
const el = React.createElement(Button, { children: [el2, el3, el4, el5] }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment