🏠 back to Observable

Embedding visualization in React app

I have a visualization in an object called genomeSpace, which is located at the top of the notebook here: Genome Space: zoom zoom zoom (revC3) / Alex Reynolds / Observable

I worked through the instructions here to set up a new React app and import the genomeSpace and related code into the app: 🤔 How to: Embed a Notebook in a React App / Observable / Observable

My App.js file looks like this:

import React, {Component} from "react";
import {Runtime, Inspector} from "@observablehq/runtime";
import notebook from "0f7b50a23d98b321";

class App extends Component {
  genomeSpaceRef = React.createRef();

  componentDidMount() {
    const runtime = new Runtime();
    runtime.module(notebook, name => {
      if (name === "genomeSpace") {
        return new Inspector(this.genomeSpaceRef.current);

  render() {
    return (
      <div className="App">
        <div ref={this.genomeSpaceRef}></div>

export default App;

In Observable, the genomeSpace visualization looks like this:

The React app development site looks like this, instead:

This appears to be a value that could come out of the notebook variable mutable pointXY, perhaps. But it is obviously not the interactive graphical element.

Am I doing something wrong to set up a React app in this way?

For completion sake, here is the web app’s package.json:

  "name": "genome-space",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "0f7b50a23d98b321": "https://api.observablehq.com/d/0f7b50a23d98b321@3386.tgz?v=3",
    "@observablehq/runtime": "4",
    "@testing-library/jest-dom": "^5.14.1",
    "@testing-library/react": "^12.0.0",
    "@testing-library/user-event": "^13.2.1",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-scripts": "5.0.0",
    "web-vitals": "^2.1.0"
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  "eslintConfig": {
    "extends": [
  "browserslist": {
    "production": [
      "not dead",
      "not op_mini all"
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"

the variable you want to embed is “viewof genomeSpace” which is different to “genomeSpace”. A viewof is a macro that creates two different cells with different dataflow nodes.