Published
Edited
Mar 23, 2020
3 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
const element = html`<div></div>`
app.on('print', p => element.innerHTML = p)
return element
}
Insert cell
Insert cell
html`<button onclick="app.run('print', new Date().toLocaleTimeString())">print current time</button>`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
app.start(document.createElement('div'), state, view, update).element;
Insert cell
Insert cell
view1 = jsx`state => {
const add = (state, num) => state + num;
return <>
<h3>{state}</h3>
<button $onclick={[add, -1]}>-1</button>
<button $onclick={[add, +1]}>+1</button>
</>;
}
`
Insert cell
app.start(document.createElement('div'), state, view1).element;
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more