examples icon indicating copy to clipboard operation
examples copied to clipboard

Add React Dataflow example using dynamic import

Open tophtucker opened this issue 2 years ago • 5 comments

A user asked Cobus if you could embed a notebook in React such that it fetches the latest published version of the notebook at runtime, instead of installing and checking in and bundling and having to redeploy if you make changes.

This also sidesteps the file attachment bundler issues! Wondering if it should be the default technique we recommend in the Embed modal.

tophtucker avatar Mar 02 '22 21:03 tophtucker

behavior is identical to https://observablehq.github.io/examples/react-dataflow/

(oops gotta update the styles in my new one)

tophtucker avatar Mar 02 '22 21:03 tophtucker

oh i could also strip out the create-react-app junk and use rollup or…

tophtucker avatar Mar 02 '22 21:03 tophtucker

Wondering if it should be the default technique we recommend in the Embed modal.

How about we call the existing method "Runtime with React (downloaded)" and add another type called "Runtime with React (dynamic)"?

CobusT avatar Mar 02 '22 21:03 CobusT

(gotta switch to some other work, will come back to this maybe tonight & rip out create-react-app so it's not 12k lines of package-lock lol)

tophtucker avatar Mar 02 '22 22:03 tophtucker

Previous create-react-app version of the PR: +11,923 lines of code

Now just adapting the rollup config from react-dataflow example: +1,039 lines of code 😅

tophtucker avatar Mar 05 '22 02:03 tophtucker