Created
September 6, 2017 02:19
-
-
Save rbiggs/3c95057ae5669e73530b91c049631dda to your computer and use it in GitHub Desktop.
Component that consumes an object.
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 personData = { | |
name: { | |
first: 'Joe', | |
last: 'Bodoni' | |
}, | |
age: 26, | |
job: 'mechanic' | |
} | |
const person = new Component({ | |
root: '#personDiv', | |
state: personData, | |
render: (person) => ( | |
<div> | |
<h2>Name: {person.name.last}, {person.name.first}</h2> | |
<h3>Age: {person.age}</h3> | |
<p>Job: {person.job}</p> | |
</div>) | |
}) | |
person.update() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment