One Todo App, Four Frontend Frameworks: What AI Changes—and What It Does Not
One Todo App, Four Frontend Frameworks: What AI Changes—and What It Does Not
The todo app has become the “Hello, World” of frontend development. It is small enough to finish in one sitting, but large enough to expose the decisions that matter: state ownership, event handling, derived data, persistence, component boundaries, accessibility and testing.
It is also a useful way to examine a modern claim: if an agentic coding tool can produce React, Vue, Svelte or Angular code on demand, does the framework still matter?
The short answer is yes—but in a different way.
AI-assisted development reduces the cost of recalling syntax, creating boilerplate and moving between ecosystems. That makes framework selection more of a contextual or personal choice than it once was. But AI does not remove the need to understand the browser, application state, data flow, accessibility, failure modes or maintainable design. In fact, when code becomes cheaper to generate, those foundations become more important because it becomes easier to generate the wrong code at speed.
Let us build the same todo application several ways and separate three things:
- the product behaviour that must remain consistent;
- the architectural ideas that transfer between frameworks;
- the framework-specific syntax an AI assistant can help us handle.
Start with behaviour, not a framework
Before opening an editor, define the application. Our todo app must allow a user to:
- add a non-empty task;
- mark a task complete or incomplete;
- delete a task;
- filter by all, active or completed;
- see the remaining active count;
- retain tasks after a page refresh;
- use the core controls with a keyboard and screen reader.
That specification is more valuable than “build me a todo app in React”. It gives both humans and agents an observable definition of success.
We can also write the data model before choosing a UI layer:
type Todo = {
id: string;
title: string;
completed: boolean;
};
type Filter = "all" | "active" | "completed";
And we can write a few invariants:
- titles are trimmed before storage;
- blank titles are rejected;
- identifiers are stable and unique;
- the remaining count is derived from todos, not independently updated;
- local storage is an external persistence mechanism, not the source of UI truth;
- filtering must not mutate the underlying collection.
These decisions are framework-independent. They are also where many generated implementations go wrong.
A small domain layer
Even for a tiny application, separating domain operations from rendering makes the code easier to test and port:
export function createTodo(title: string): Todo | null {
const cleanTitle = title.trim();
if (!cleanTitle) return null;
return {
id: crypto.randomUUID(),
title: cleanTitle,
completed: false
};
}
export function toggleTodo(todos: Todo[], id: string): Todo[] {
return todos.map(todo =>
todo.id === id
? { ...todo, completed: !todo.completed }
: todo
);
}
export function removeTodo(todos: Todo[], id: string): Todo[] {
return todos.filter(todo => todo.id !== id);
}
export function filterTodos(todos: Todo[], filter: Filter): Todo[] {
if (filter === "active") return todos.filter(todo => !todo.completed);
if (filter === "completed") return todos.filter(todo => todo.completed);
return todos;
}
There is nothing especially React-like, Vue-like or Svelte-like here. These are ordinary TypeScript functions. Immutability is useful because it makes state transitions explicit, although different frameworks have different reactivity rules and can also work with controlled mutation.
This is the first major lesson: the most reusable part of an application is often not a component. It is the model and behaviour beneath the component.
Implementation 1: React
React makes state transitions explicit. A compact implementation can use useState, useMemo and useEffect:
import { FormEvent, useEffect, useMemo, useState } from "react";
import {
createTodo,
filterTodos,
removeTodo,
toggleTodo
} from "./todo-domain";
const STORAGE_KEY = "framework-todos";
export default function TodoApp() {
const [todos, setTodos] = useState<Todo[]>(() => {
try {
return JSON.parse(localStorage.getItem(STORAGE_KEY) ?? "[]");
} catch {
return [];
}
});
const [title, setTitle] = useState("");
const [filter, setFilter] = useState<Filter>("all");
useEffect(() => {
localStorage.setItem(STORAGE_KEY, JSON.stringify(todos));
}, [todos]);
const visibleTodos = useMemo(
() => filterTodos(todos, filter),
[todos, filter]
);
const remaining = todos.filter(todo => !todo.completed).length;
function handleSubmit(event: FormEvent) {
event.preventDefault();
const todo = createTodo(title);
if (!todo) return;
setTodos(current => [...current, todo]);
setTitle("");
}
return (
<main>
<h1>Tasks</h1>
<form onSubmit={handleSubmit}>
<label htmlFor="new-task">New task</label>
<input
id="new-task"
value={title}
onChange={event => setTitle(event.target.value)}
/>
<button type="submit">Add</button>
</form>
<div aria-label="Filter tasks">
{(["all", "active", "completed"] as Filter[]).map(option => (
<button
key={option}
type="button"
aria-pressed={filter === option}
onClick={() => setFilter(option)}
>
{option}
</button>
))}
</div>
<ul>
{visibleTodos.map(todo => (
<li key={todo.id}>
<label>
<input
type="checkbox"
checked={todo.completed}
onChange={() =>
setTodos(current => toggleTodo(current, todo.id))
}
/>
<span>{todo.title}</span>
</label>
<button
type="button"
aria-label={`Delete ${todo.title}`}
onClick={() =>
setTodos(current => removeTodo(current, todo.id))
}
>
Delete
</button>
</li>
))}
</ul>
<p aria-live="polite">{remaining} tasks remaining</p>
</main>
);
}
React’s trade-off is visible ceremony. State setters, dependency arrays and controlled inputs make the flow clear, but generated code can easily introduce stale closures, unnecessary effects or duplicated state.
A good review question is: Could this value be calculated during render? If yes, it probably does not need another state variable or effect. The remaining count and filtered list are derived values.
Implementation 2: Vue
Vue’s Composition API expresses the same model using refs, computed values and watchers:
<script setup lang="ts">
import { computed, ref, watch } from "vue";
import {
createTodo,
filterTodos,
removeTodo,
toggleTodo
} from "./todo-domain";
const STORAGE_KEY = "framework-todos";
function loadTodos(): Todo[] {
try {
return JSON.parse(localStorage.getItem(STORAGE_KEY) ?? "[]");
} catch {
return [];
}
}
const todos = ref<Todo[]>(loadTodos());
const title = ref("");
const filter = ref<Filter>("all");
const visibleTodos = computed(() =>
filterTodos(todos.value, filter.value)
);
const remaining = computed(
() => todos.value.filter(todo => !todo.completed).length
);
watch(
todos,
value => localStorage.setItem(STORAGE_KEY, JSON.stringify(value)),
{ deep: true }
);
function addTodo() {
const todo = createTodo(title.value);
if (!todo) return;
todos.value = [...todos.value, todo];
title.value = "";
}
function toggle(id: string) {
todos.value = toggleTodo(todos.value, id);
}
function remove(id: string) {
todos.value = removeTodo(todos.value, id);
}
</script>
<template>
<main>
<h1>Tasks</h1>
<form @submit.prevent="addTodo">
<label for="new-task">New task</label>
<input id="new-task" v-model="title" />
<button type="submit">Add</button>
</form>
<div aria-label="Filter tasks">
<button
v-for="option in ['all', 'active', 'completed']"
:key="option"
type="button"
:aria-pressed="filter === option"
@click="filter = option as Filter"
>
{{ option }}
</button>
</div>
<ul>
<li v-for="todo in visibleTodos" :key="todo.id">
<label>
<input
type="checkbox"
:checked="todo.completed"
@change="toggle(todo.id)"
/>
<span>{{ todo.title }}</span>
</label>
<button
type="button"
:aria-label="`Delete ${todo.title}`"
@click="remove(todo.id)"
>
Delete
</button>
</li>
</ul>
<p aria-live="polite">{{ remaining }} tasks remaining</p>
</main>
</template>
Vue reduces some event-handling noise through directives such as v-model and @submit.prevent. The conceptual model is still the same: source state, derived state, transitions and a persistence side effect.
An AI assistant can translate React syntax into Vue quickly. The engineering work is checking whether it preserved those concepts or merely produced code that looks plausible.
Implementation 3: Svelte
Svelte keeps much of the component logic close to ordinary JavaScript. Using current rune-style state, the component can be concise:
<script lang="ts">
import {
createTodo,
filterTodos,
removeTodo,
toggleTodo
} from "./todo-domain";
const STORAGE_KEY = "framework-todos";
function loadTodos(): Todo[] {
try {
return JSON.parse(localStorage.getItem(STORAGE_KEY) ?? "[]");
} catch {
return [];
}
}
let todos = $state<Todo[]>(loadTodos());
let title = $state("");
let filter = $state<Filter>("all");
let visibleTodos = $derived(filterTodos(todos, filter));
let remaining = $derived(
todos.filter(todo => !todo.completed).length
);
$effect(() => {
localStorage.setItem(STORAGE_KEY, JSON.stringify(todos));
});
function addTodo() {
const todo = createTodo(title);
if (!todo) return;
todos = [...todos, todo];
title = "";
}
</script>
<main>
<h1>Tasks</h1>
<form
onsubmit={(event) => {
event.preventDefault();
addTodo();
}}
>
<label for="new-task">New task</label>
<input id="new-task" bind:value={title} />
<button type="submit">Add</button>
</form>
<div aria-label="Filter tasks">
{#each ["all", "active", "completed"] as option}
<button
type="button"
aria-pressed={filter === option}
onclick={() => filter = option as Filter}
>
{option}
</button>
{/each}
</div>
<ul>
{#each visibleTodos as todo (todo.id)}
<li>
<label>
<input
type="checkbox"
checked={todo.completed}
onchange={() => todos = toggleTodo(todos, todo.id)}
/>
<span>{todo.title}</span>
</label>
<button
type="button"
aria-label={`Delete ${todo.title}`}
onclick={() => todos = removeTodo(todos, todo.id)}
>
Delete
</button>
</li>
{/each}
</ul>
<p aria-live="polite">{remaining} tasks remaining</p>
</main>
Svelte’s appeal is that the reactivity can feel direct. But “less code” does not mean “no model”. We still need to understand what is source state, what is derived and what is a side effect. An agent that places persistence, filtering and mutation in arbitrary reactive blocks can create loops or hard-to-explain behaviour just as easily as it can in another framework.
Implementation 4: Angular
Angular provides a more structured application model. Signals allow the component state to remain compact:
import { Component, computed, effect, signal } from "@angular/core";
import { FormsModule } from "@angular/forms";
@Component({
selector: "app-todos",
standalone: true,
imports: [FormsModule],
templateUrl: "./todos.component.html"
})
export class TodosComponent {
private readonly storageKey = "framework-todos";
readonly todos = signal<Todo[]>(this.loadTodos());
readonly filter = signal<Filter>("all");
title = "";
readonly visibleTodos = computed(() =>
filterTodos(this.todos(), this.filter())
);
readonly remaining = computed(
() => this.todos().filter(todo => !todo.completed).length
);
constructor() {
effect(() => {
localStorage.setItem(
this.storageKey,
JSON.stringify(this.todos())
);
});
}
addTodo(): void {
const todo = createTodo(this.title);
if (!todo) return;
this.todos.update(current => [...current, todo]);
this.title = "";
}
toggle(id: string): void {
this.todos.update(current => toggleTodo(current, id));
}
remove(id: string): void {
this.todos.update(current => removeTodo(current, id));
}
private loadTodos(): Todo[] {
try {
return JSON.parse(
localStorage.getItem(this.storageKey) ?? "[]"
);
} catch {
return [];
}
}
}
<main>
<h1>Tasks</h1>
<form (ngSubmit)="addTodo()">
<label for="new-task">New task</label>
<input id="new-task" name="title" [(ngModel)]="title" />
<button type="submit">Add</button>
</form>
<div aria-label="Filter tasks">
@for (option of ["all", "active", "completed"]; track option) {
<button
type="button"
[attr.aria-pressed]="filter() === option"
(click)="filter.set($any(option))"
>
{{ option }}
</button>
}
</div>
<ul>
@for (todo of visibleTodos(); track todo.id) {
<li>
<label>
<input
type="checkbox"
[checked]="todo.completed"
(change)="toggle(todo.id)"
/>
<span>{{ todo.title }}</span>
</label>
<button
type="button"
[attr.aria-label]="'Delete ' + todo.title"
(click)="remove(todo.id)"
>
Delete
</button>
</li>
}
</ul>
<p aria-live="polite">
{{ remaining() }} tasks remaining
</p>
</main>
Angular asks you to adopt more conventions. That can feel heavy for a todo app, but those conventions can become valuable across a large team: dependency injection, routing, forms, testing and project structure have established homes.
AI makes the initial ceremony cheaper, but the long-term trade-off remains. A framework is not only the code needed to render a checkbox; it is the operating model a team will use to change the product for years.
What the frameworks are really doing
Across all four implementations, the essential design is nearly identical:
- Store the canonical list of todos.
- Store the selected filter and current input.
- Derive the visible list and remaining count.
- Run explicit transitions when the user acts.
- Synchronise the canonical list to external storage.
- Render semantic HTML and accessible controls.
The syntax varies. The mental model does not.
This is why agentic tools make framework choice feel more personal. If an assistant can explain unfamiliar syntax, generate components, add tests and repair compiler errors, the cost of entering a framework falls. You can choose based on team experience, ecosystem, organisational constraints, performance characteristics, hiring, maintainability and preference—not merely on which syntax you can remember.
But lower entry cost is not zero ownership cost.
A better prompt than “build a todo app”
Agentic coding quality depends heavily on the shape of the task. A useful implementation prompt might be:
You are working in an existing TypeScript frontend repository.
Build an accessible todo feature using the framework and conventions
already present in the repository.
Required behaviour:
- Add a task after trimming its title.
- Reject blank titles.
- Toggle complete/incomplete.
- Delete a task.
- Filter all, active and completed.
- Display the active count.
- Persist tasks to localStorage.
- Recover safely from malformed stored JSON.
Engineering constraints:
- Use semantic HTML.
- Every input must have an accessible label.
- Filter buttons must expose their selected state.
- Delete buttons must include the task title in their accessible name.
- Treat the todo list as canonical state.
- Derive filtered todos and remaining count; do not duplicate them in state.
- Keep domain transitions in pure TypeScript functions.
- Do not add a state library.
- Follow the repository's existing formatting, testing and component patterns.
Before coding:
1. Inspect package.json and the source tree.
2. Identify the framework version and local conventions.
3. Propose the files to change.
4. List assumptions and acceptance tests.
After coding:
1. Run type checking, unit tests and linting.
2. Add tests for blank input, toggle, deletion, filtering,
malformed storage and keyboard submission.
3. Summarise trade-offs and any behaviour not verified.
This prompt does not prescribe React or Vue. It asks the agent to discover the environment, preserve local conventions and prove the behaviour. That is closer to professional development than requesting a code dump.
Use an agent as an implementation partner, not an oracle
A productive loop is:
- Specify: define behaviour, constraints and failure cases.
- Inspect: make the agent read the repository before proposing changes.
- Plan: ask for files, state ownership and test cases.
- Implement: keep the change small enough to review.
- Verify: run the application, tests, type checker and accessibility checks.
- Review: ask why each effect, state value and dependency exists.
- Simplify: remove generated abstractions that do not pay for themselves.
Useful follow-up prompts include:
Review this implementation for duplicated state, unnecessary effects,
stale closures, mutation bugs and framework-specific anti-patterns.
Do not rewrite it until you have explained each finding.
Trace the data flow from form submission to rendered list and localStorage.
Identify every point where invalid or stale data could enter the system.
Test this component as a user would. Cover keyboard-only interaction,
screen-reader names, refresh persistence and malformed localStorage.
Prefer behavioural tests over implementation-detail tests.
Port only the UI adapter from React to Vue. Preserve the domain functions
and acceptance tests. Explain which concepts map directly and which do not.
The final prompt is particularly revealing. If the domain layer and behavioural tests transfer cleanly, the application has been designed around fundamentals rather than framework accidents.
Test behaviour once, syntax separately
The pure functions can be tested without rendering any framework:
import { describe, expect, it } from "vitest";
import {
createTodo,
filterTodos,
removeTodo,
toggleTodo
} from "./todo-domain";
describe("todo domain", () => {
it("rejects blank titles", () => {
expect(createTodo(" ")).toBeNull();
});
it("trims titles", () => {
expect(createTodo(" Write tests ")?.title)
.toBe("Write tests");
});
it("toggles only the selected todo", () => {
const todos: Todo[] = [
{ id: "1", title: "A", completed: false },
{ id: "2", title: "B", completed: false }
];
const result = toggleTodo(todos, "2");
expect(result[0].completed).toBe(false);
expect(result[1].completed).toBe(true);
});
it("filters active todos without changing the source", () => {
const todos: Todo[] = [
{ id: "1", title: "A", completed: false },
{ id: "2", title: "B", completed: true }
];
expect(filterTodos(todos, "active")).toEqual([todos[0]]);
expect(todos).toHaveLength(2);
});
it("removes by stable identifier", () => {
const todos: Todo[] = [
{ id: "1", title: "Same title", completed: false },
{ id: "2", title: "Same title", completed: false }
];
expect(removeTodo(todos, "1")).toEqual([todos[1]]);
});
});
Then add a smaller number of framework-level tests to verify integration: submitting the form, changing the filter, clicking a checkbox, deleting a task and reloading persisted data.
Do not let an agent produce dozens of brittle tests that assert internal function calls, CSS classes or component implementation details. A todo app is successful because the user can manage tasks, not because a particular hook ran once.
The foundations AI does not replace
1. HTML is still the application’s interface
A clickable div is not equivalent to a button. A placeholder is not a label. Visual strikethrough is not a programmatic completed state. Semantic elements provide keyboard behaviour, focus handling and accessible meaning before a framework adds anything.
2. State must have ownership
Every piece of data should have one authoritative home. If the full list, filtered list and remaining count can all be independently updated, they will eventually disagree. Derived values should remain derived.
3. Side effects need boundaries
Writing to storage, calling an API, recording analytics and manipulating focus are effects. They should be clearly separated from calculations. Framework APIs differ, but the distinction between calculation and effect is universal.
4. Persistence is not correctness
localStorage can contain old, malformed or manually edited data. Production code may need schema validation and migrations. Moving to a server introduces authentication, authorisation, concurrency, retries and conflict handling. A generated persistence call is only the beginning.
5. Performance comes from understanding change
Memoisation is not a decoration to add everywhere. Rendering ten todos does not need heroic optimisation. Understand what changes, what is recalculated and what users can perceive before reaching for framework-specific performance APIs.
6. Tests are executable product decisions
The most valuable tests encode rules such as “blank titles are rejected” and “filtering does not delete data”. They survive framework migrations because they describe behaviour, not syntax.
So which framework should you choose?
For a personal project, choose the framework that helps you sustain momentum and understand the resulting code. Preference is a legitimate factor.
For a team or long-lived product, consider:
- existing expertise and codebase conventions;
- ecosystem maturity for your actual requirements;
- server rendering and deployment needs;
- accessibility and testing support;
- upgrade cadence and migration history;
- debugging and observability;
- the ease of reviewing generated code;
- whether the team can operate the application without the agent that created it.
AI lowers the cost of trying each option. A useful exercise is to build this same todo specification in two frameworks, run the tests and compare the code you would be willing to maintain six months later.
Do not compare only line counts. Compare clarity.
The real lesson of the todo app
The todo app is not valuable because the world needs another task list. It is valuable because it exposes the full loop of frontend engineering in miniature.
Agentic coding tools can now generate each version quickly. That makes syntax less of a gate and experimentation more affordable. It may even let teams choose frameworks based on genuine product and organisational fit rather than habit.
But the agent still needs direction. Someone must define correct behaviour, recognise duplicated state, challenge an unnecessary abstraction, inspect accessibility, validate persistence, design tests and decide whether the result belongs in the codebase.
The framework is increasingly a choice.
The foundations are not.
Comments
Post a Comment