Last active
September 6, 2017 02:43
-
-
Save rbiggs/ae5037a5c912baa4dea445c2151e1d59 to your computer and use it in GitHub Desktop.
A component that consumes an array
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 {h, Component} from 'composi' | |
const fruits = [ | |
'Apples', 'Oranges', 'Bananas', 'Strawberries' | |
] | |
const list = new Component({ | |
root: 'section', | |
state: fruits, | |
// Use map on array of fruits: | |
render: (fruits) => ( | |
<ul> | |
{ | |
fruits.map(fruit => <li>{fruit}</li>) | |
} | |
</ul> | |
) | |
}) | |
list.update() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment