Skip to content
Start free

Using frameworks

Yoyo serves static files and doesn’t run a bundler — there’s no npm install and no node_modules. You can still use a framework: modern browsers load ES modules straight from a CDN, and an import map lets you write normal import statements against them.

This works today on every plan, including Free.

<!doctype html>
<html>
<body>
<div id="app"></div>
<script type="importmap">
{
"imports": {
"preact": "https://esm.sh/preact@10",
"preact/hooks": "https://esm.sh/preact@10/hooks",
"htm/preact": "https://esm.sh/htm@3/preact?external=preact"
}
}
</script>
<script type="module">
import { render } from 'preact';
import { useState } from 'preact/hooks';
import { html } from 'htm/preact';
function Counter() {
const [count, setCount] = useState(0);
return html`<button onClick=${() => setCount(count + 1)}>
Clicked ${count} times
</button>`;
}
render(html`<${Counter} />`, document.getElementById('app'));
</script>
</body>
</html>

The same pattern works for React — map react and react-dom/client to esm.sh and use htm for JSX-like syntax:

{
"imports": {
"react": "https://esm.sh/react@19",
"react-dom/client": "https://esm.sh/react-dom@19/client",
"htm": "https://esm.sh/htm@3"
}
}
import { createElement } from 'react';
import { createRoot } from 'react-dom/client';
import htm from 'htm';
const html = htm.bind(createElement);
createRoot(document.getElementById('app')).render(html`<h1>Hello from React</h1>`);
  • No JSX or TypeScript compilation. Browsers can’t run .jsx or .ts directly and Yoyo doesn’t transpile. Use htm tagged templates instead of JSX, and plain JavaScript (JSDoc comments work for type hints in your editor).
  • Pin major versions in your import map (preact@10, react@19) so a future release doesn’t change your demo underneath you.
  • Need a real build (Vite, Next.js, npm dependencies)? Build locally and deploy the output folder with the CLI: yoyo deploy ./dist.