Skip to content

Instantly share code, notes, and snippets.

@rbiggs
Last active September 6, 2017 02:43
Show Gist options
  • Save rbiggs/ae5037a5c912baa4dea445c2151e1d59 to your computer and use it in GitHub Desktop.
Save rbiggs/ae5037a5c912baa4dea445c2151e1d59 to your computer and use it in GitHub Desktop.
A component that consumes an array
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