Published
Edited
Oct 22, 2019
10 stars
Insert cell
Insert cell
Insert cell
import { React, jsx } from '@mbostock/hello-jsx'
Insert cell
React.render(jsx`<div style={{fontWeight:800}}>Hello!</div>`)
Insert cell
Insert cell
function List(props) {
const { items } = props;
return jsx({ items })`<div>
<ul>
${items.map(item => `<li>${item}</li>`).join('')}
</ul>
</div>`;
}
Insert cell
React.render(jsx({ List, items: ['a', 'b', 'c'] })`<List items={items}/>`)
Insert cell
Insert cell
Notebook = (await require('@alex.garcia/observable-notebook-react@0.0.6/build/index.umd.js'))(
React
)
Insert cell
React.render(
jsx({
Notebook,
define: (await import(
'https://api.observablehq.com/@tmcw/hello-world.js?v=3'
)).default
})`<Notebook define={define}/>`
)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
hello = React.render(
jsx({
style: boxStyle('#ccc')
})`<div style={style}>Hello!</div>`
)
Insert cell
Insert cell
thisNotebookDefine = {
await visibility(); // wait until reader scrolls down here to load (for faster TTI)
return (await import(`https://api.observablehq.com/d/4df45c62fdc40249.js?v=3`))
.default;
}
Insert cell
hello2 = React.render(
jsx({
Notebook,
define: thisNotebookDefine,
targets: ["hello"],
style: boxStyle('red')
})`<div style={style}>
<Notebook define={define} targets={targets}/>
</div>`
)
Insert cell
Insert cell
hello3 = React.render(
jsx({
Notebook,
define: thisNotebookDefine,
targets: ["hello2"],
style: boxStyle('red')
})`<div style={style}>
<Notebook define={define} targets={targets}/>
</div>`
)
Insert cell
hello4 = React.render(
jsx({
Notebook,
define: thisNotebookDefine,
targets: ["hello3"],
style: boxStyle('red')
})`<div style={style}>
<Notebook define={define} targets={targets}/>
</div>`
)
Insert cell
hello5 = React.render(
jsx({
Notebook,
define: thisNotebookDefine,
targets: ["hello4"],
style: boxStyle('red')
})`<div style={style}>
<Notebook define={define} targets={targets}/>
</div>`
)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more