you-dont-need-react

you-dont-need-react
git clone git://brookjeynes.dev/bjeynes/you-dont-need-react.git
Log | Files | Refs | README

commit 5410fc7e436446b2495d320842f8e2d7d18d438d
parent cf2c8af157ed40c5a4a806c8ba94616171c4ad46
Author: brookjeynes <me@brookjeynes.dev>
Date:   Thu, 19 Nov 2026 07:14:41 +1000

add presentation slides and update readme

Signed-off-by: brookjeynes <me@brookjeynes.dev>

Diffstat:
MREADME.rst | 4++--
Aassets/create-task.gif | 0
Aassets/delete-task.gif | 0
Aassets/form-submit-diagram.html | 13+++++++++++++
Aassets/hx-swap-flow.html | 11+++++++++++
Aassets/kanban-demo.gif | 0
Aassets/post-request-fields.html | 1+
Aassets/task-drag-flow.html | 10++++++++++
Apresentation.odp | 0
Mstatic/js/task-card.js | 12++++++------
10 files changed, 43 insertions(+), 8 deletions(-)

diff --git a/README.rst b/README.rst @@ -4,10 +4,10 @@ You don't need React: Build lean with HTMX and Web Components Most websites are static pages, forms, and the occasional data table. So why do we build websites like we need to harness the power of the sun (and the user's -entire cpu)? What if we just... didn't? +entire CPU)? What if we just... didn't? In this talk, Brook will build a dynamic application live. No virtual DOM, -client-side router, or build step — just letting HTML, JS, and your server do +client-side router, or build step, just letting HTML, JS, and your server do their thing. By the end, you'll have new guidelines for when to use a framework like React, diff --git a/assets/create-task.gif b/assets/create-task.gif Binary files differ. diff --git a/assets/delete-task.gif b/assets/delete-task.gif Binary files differ. diff --git a/assets/form-submit-diagram.html b/assets/form-submit-diagram.html @@ -0,0 +1,13 @@ +<!doctype html> +<html lang="en"> +<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Submitting a form without htmx</title><style>body{margin:0;background:#15181c;color:#f2f4f7;font-family:Arial,sans-serif}.diagram{overflow-x:auto}svg{display:block;min-width:1200px;width:100%;height:auto}text{fill:#f2f4f7;font-family:Arial,sans-serif}.code{font-family:'Courier New',monospace;fill:#c9b98f}.value{fill:#87afaf}</style></head> +<body><div class="diagram"><svg viewBox="0 0 1200 520" role="img" aria-labelledby="form-submit-title form-submit-desc" xmlns="http://www.w3.org/2000/svg"> +<title id="form-submit-title">Submitting a form without htmx</title><desc id="form-submit-desc">The browser sends a POST request with the form value to the server, receives an HTML document, and navigates to the returned page.</desc> +<defs><marker id="arrow" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="8" markerHeight="8" orient="auto"><path d="M0 0 L8 4 L0 8 Z" fill="#f2f4f7"/></marker></defs> +<g fill="none" stroke="#f2f4f7" stroke-width="2"><path d="M280 100 V420 M920 100 V420" stroke-dasharray="6 8" opacity=".5"/><path d="M280 200 H920" marker-end="url(#arrow)"/><path d="M920 310 H280" stroke-dasharray="8 6" marker-end="url(#arrow)"/></g> +<rect x="160" y="36" width="240" height="64" fill="#15181c" stroke="#f2f4f7" stroke-width="2"/><text x="280" y="77" text-anchor="middle" font-size="30" font-weight="bold">Browser</text> +<rect x="800" y="36" width="240" height="64" fill="#15181c" stroke="#f2f4f7" stroke-width="2"/><text x="920" y="77" text-anchor="middle" font-size="30" font-weight="bold">Server</text> +<text class="code" x="600" y="180" text-anchor="middle" font-size="26">POST /task/new</text> +<text class="value" x="600" y="290" text-anchor="middle" font-size="26" font-family="Courier New, monospace">&lt;html&gt;…&lt;/html&gt;</text> +<rect x="88" y="424" width="384" height="64" fill="#15181c" stroke="#f2f4f7" stroke-width="2"/><text x="280" y="465" text-anchor="middle" font-size="25">Browser loads the new page</text> +</svg></div></body></html> diff --git a/assets/hx-swap-flow.html b/assets/hx-swap-flow.html @@ -0,0 +1,10 @@ +<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>From response to list</title><style>body{margin:0;background:#15181c;color:#f2f4f7;font-family:Arial,sans-serif}svg{display:block;width:100%;min-width:1200px;height:auto}main{overflow-x:auto}text{fill:#f2f4f7;font-family:Arial,sans-serif}.heading{font-size:25px;font-weight:bold}.label{font-size:16px;font-weight:bold;text-anchor:middle}.task{font-size:21px;text-anchor:middle}.code{font:18px 'Courier New',monospace;text-anchor:middle}.center{text-anchor:middle}.accent{fill:#87afaf}.target{fill:#c9b98f}</style></head><body><main><svg viewBox="0 0 1200 440" role="img" aria-labelledby="swap-1-title swap-1-desc" xmlns="http://www.w3.org/2000/svg"><title id="swap-1-title">01 The response arrives</title><desc id="swap-1-desc">The response comes to htmx, which finds the task list and appends a new list item before its end.</desc><defs><marker id="swap-1-arrow" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="8" markerHeight="8" orient="auto"><path d="M0 0 L8 4 L0 8 Z" fill="#f2f4f7"/></marker></defs> +<text x="80" y="48" class="heading">01 The response arrives</text><rect x="80" y="142" width="296" height="148" fill="none" stroke="#87afaf" stroke-width="2"/><text x="228" y="183" class="label">SERVER RESPONSE</text><text x="228" y="230" class="code accent">&lt;li&gt;Buy milk&lt;/li&gt;</text> +<path d="M376 216 H468" fill="none" stroke="#f2f4f7" stroke-width="2" marker-end="url(#swap-1-arrow)"/><rect x="472" y="174" width="144" height="84" fill="none" stroke="#f2f4f7" stroke-width="2"/><text x="544" y="226" class="heading center">htmx</text><path d="M616 216 H716" fill="none" stroke="#f2f4f7" stroke-width="2" stroke-dasharray="8 6" marker-end="url(#swap-1-arrow)"/> +<rect x="720" y="98" width="348" height="276" fill="none" stroke="#f2f4f7" stroke-width="2"/><path d="M720 154 H1068" fill="none" stroke="#f2f4f7" stroke-width="2"/><text x="884" y="135" class="label">PAGE / TO DO</text><rect x="744" y="190" width="300" height="152" fill="none" stroke="#f2f4f7" stroke-width="2"/><text x="894" y="220" class="code target">#task-list-todo</text><text x="888" y="269" class="task">Read book</text><text x="600" y="424" class="code target">HTML comes back from POST /task/new</text></svg><svg viewBox="0 0 1200 440" role="img" aria-labelledby="swap-2-title swap-2-desc" xmlns="http://www.w3.org/2000/svg"><title id="swap-2-title">02 Find the target</title><desc id="swap-2-desc">The response comes to htmx, which finds the task list and appends a new list item before its end.</desc><defs><marker id="swap-2-arrow" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="8" markerHeight="8" orient="auto"><path d="M0 0 L8 4 L0 8 Z" fill="#f2f4f7"/></marker></defs> +<text x="80" y="48" class="heading">02 Find the target</text><rect x="80" y="142" width="296" height="148" fill="none" stroke="#f2f4f7" stroke-width="2"/><text x="228" y="183" class="label">SERVER RESPONSE</text><text x="228" y="230" class="code accent">&lt;li&gt;Buy milk&lt;/li&gt;</text> +<path d="M376 216 H468" fill="none" stroke="#f2f4f7" stroke-width="2" marker-end="url(#swap-2-arrow)"/><rect x="472" y="174" width="144" height="84" fill="none" stroke="#f2f4f7" stroke-width="2"/><text x="544" y="226" class="heading center">htmx</text><path d="M616 216 H716" fill="none" stroke="#f2f4f7" stroke-width="2" stroke-dasharray="8 6" marker-end="url(#swap-2-arrow)"/> +<rect x="720" y="98" width="348" height="276" fill="none" stroke="#f2f4f7" stroke-width="2"/><path d="M720 154 H1068" fill="none" stroke="#f2f4f7" stroke-width="2"/><text x="884" y="135" class="label">PAGE / TO DO</text><rect x="744" y="190" width="300" height="152" fill="none" stroke="#c9b98f" stroke-width="2"/><text x="894" y="220" class="code target">#task-list-todo</text><text x="888" y="269" class="task">Read book</text><text x="600" y="424" class="code target">hx-target points to the list</text></svg><svg viewBox="0 0 1200 440" role="img" aria-labelledby="swap-3-title swap-3-desc" xmlns="http://www.w3.org/2000/svg"><title id="swap-3-title">03 Add the new item</title><desc id="swap-3-desc">The response comes to htmx, which finds the task list and appends a new list item before its end.</desc><defs><marker id="swap-3-arrow" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="8" markerHeight="8" orient="auto"><path d="M0 0 L8 4 L0 8 Z" fill="#f2f4f7"/></marker></defs> +<text x="80" y="48" class="heading">03 Add the new item</text><rect x="80" y="142" width="296" height="148" fill="none" stroke="#f2f4f7" stroke-width="2"/><text x="228" y="183" class="label">SERVER RESPONSE</text><text x="228" y="230" class="code accent">&lt;li&gt;Buy milk&lt;/li&gt;</text> +<path d="M376 216 H468" fill="none" stroke="#f2f4f7" stroke-width="2" marker-end="url(#swap-3-arrow)"/><rect x="472" y="174" width="144" height="84" fill="none" stroke="#f2f4f7" stroke-width="2"/><text x="544" y="226" class="heading center">htmx</text><path d="M616 216 H716" fill="none" stroke="#f2f4f7" stroke-width="2" marker-end="url(#swap-3-arrow)"/> +<rect x="720" y="98" width="348" height="276" fill="none" stroke="#f2f4f7" stroke-width="2"/><path d="M720 154 H1068" fill="none" stroke="#f2f4f7" stroke-width="2"/><text x="884" y="135" class="label">PAGE / TO DO</text><rect x="744" y="190" width="300" height="152" fill="none" stroke="#f2f4f7" stroke-width="2"/><text x="894" y="220" class="code target">#task-list-todo</text><text x="888" y="269" class="task">Read book</text><rect x="768" y="300" width="240" height="44" fill="none" stroke="#87afaf" stroke-width="2"/><text x="888" y="329" class="task accent">Buy milk</text><text x="600" y="424" class="code target">hx-swap=&quot;beforeend&quot; adds inside the list</text></svg></main></body></html> +\ No newline at end of file diff --git a/assets/kanban-demo.gif b/assets/kanban-demo.gif Binary files differ. diff --git a/assets/post-request-fields.html b/assets/post-request-fields.html @@ -0,0 +1 @@ +<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>POST request fields</title><style>body{margin:0;background:#15181c;font-family:Arial,sans-serif}main{overflow-x:auto}svg{display:block;width:100%;height:auto;min-width:1200px}text{fill:#f2f4f7;text-anchor:middle;font-family:Arial,sans-serif}.heading{font-size:25px;font-weight:bold}.code{font:25px 'Courier New',monospace}.method{fill:#c8aeff}.field{fill:#c9b98f}.type{font-size:19px}</style></head><body><main><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 500" role="img" aria-labelledby="post-request-fields-title post-request-fields-desc"><title id="post-request-fields-title">POST request fields</title><desc id="post-request-fields-desc">The POST request to task new contains a title and a hidden column ID in its form-encoded body.</desc><text x="600" y="90" class="heading">The form sends both values</text><text x="600" y="160" class="code method">POST /task/new</text><rect x="120" y="220" width="440" height="100" fill="none" stroke="#f2f4f7" stroke-width="2"/><rect x="640" y="220" width="440" height="100" fill="none" stroke="#f2f4f7" stroke-width="2"/><text x="340" y="280" class="code field">title=Buy+groceries</text><text x="860" y="280" class="code field">column_id=todo</text><text x="600" y="390" class="type">Content-Type: application/x-www-form-urlencoded</text></svg></main></body></html> diff --git a/assets/task-drag-flow.html b/assets/task-drag-flow.html @@ -0,0 +1,10 @@ +<!doctype html> +<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>How the task moves</title><style>body{margin:0;background:#15181c;color:#f2f4f7;font-family:Arial,sans-serif}main{overflow-x:auto}svg{width:100%;min-width:1200px;height:auto;display:block}text{fill:#f2f4f7;text-anchor:middle;font-family:Arial,sans-serif}.title{font-size:24px;font-weight:bold}.label{font-size:18px;font-weight:bold}.code{font:20px 'Courier New',monospace;fill:#c9b98f}.accent{fill:#87afaf}.body{font-size:20px}</style></head><body><main> +<svg viewBox="0 0 1200 450" role="img" aria-labelledby="task-drag-flow-title task-drag-flow-desc" xmlns="http://www.w3.org/2000/svg"><title id="task-drag-flow-title">How the task moves</title><desc id="task-drag-flow-desc">A dragged task stores its ID in dataTransfer; the drop handler reads that ID and moves the task to the destination column.</desc> +<defs><marker id="task-drag-arrow" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="8" markerHeight="8" orient="auto"><path d="M0 0 L8 4 L0 8 Z" fill="#f2f4f7"/></marker></defs> +<path d="M348 220 H444 M756 220 H852" fill="none" stroke="#f2f4f7" stroke-width="2" marker-end="url(#task-drag-arrow)"/> +<rect x="80" y="164" width="264" height="112" fill="none" stroke="#f2f4f7" stroke-width="2"/><rect x="448" y="164" width="304" height="112" fill="none" stroke="#f2f4f7" stroke-width="2"/><rect x="856" y="164" width="264" height="112" fill="none" stroke="#f2f4f7" stroke-width="2"/> +<text x="212" y="130" class="label">DRAG START</text><text x="600" y="130" class="label">DATA TRANSFER</text><text x="988" y="130" class="label">DROP</text> +<text x="212" y="226" class="body">Buy groceries</text><text x="600" y="226" class="code">id: abc123</text><text x="988" y="226" class="body accent">Buy groceries</text> +<text x="212" y="314" class="body">To do</text><text x="988" y="314" class="body">In progress</text><text x="600" y="397" class="body">The ID travels with the drag; drop reads it.</text> +</svg></main></body></html> diff --git a/presentation.odp b/presentation.odp Binary files differ. diff --git a/static/js/task-card.js b/static/js/task-card.js @@ -40,14 +40,14 @@ document.addEventListener("DOMContentLoaded", () => { e.preventDefault(); e.dataTransfer.dropEffect = "move"; - //list.classList.add("-dragover"); + list.classList.add("-dragover"); }); - //board.addEventListener("dragleave", (e) => { - // const list = e.target.closest(".task-list"); - // if (!list || list.contains(e.relatedTarget)) return; - // list.classList.remove("-dragover"); - //}); + board.addEventListener("dragleave", (e) => { + const list = e.target.closest(".task-list"); + if (!list || list.contains(e.relatedTarget)) return; + list.classList.remove("-dragover"); + }); board.addEventListener("drop", (e) => { const toList = e.target.closest(".task-list");