Published
Edited
Apr 20, 2022
2 forks
Insert cell
Insert cell
htmlList = {
// Forces update to be executed first. Try commenting the following line and re-executing
update;

return html`
<h2>Current state</h2>
${viewof newItem}
<ul>
${listOfItems.map((i) => `<li>${i}</li>`)}
</ul>`;
}
Insert cell
Insert cell
listOfItems = []
Insert cell
Insert cell
viewof newItem = Inputs.text({ label: "Add a new item:", submit: true })
Insert cell
Insert cell
update = {
// only add a new item if it has value
if (newItem) listOfItems.push(newItem);
}
Insert cell
Insert cell
id = "@john-guerra/forcing-execution-order"
Insert cell
import { chart } with { id } from "@observablehq/notebook-visualizer"
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