diff --git a/README.md b/README.md index fb3507d..7f53eba 100644 --- a/README.md +++ b/README.md @@ -1,113 +1,168 @@ -# Lit-Only Architecture (No Build) +# Lit + Zustand Architecture -A minimal, no-build web application using only Lit web components with local state management. - -> **Note:** This is the `lit-only` branch. For the full-featured version with Zustand state management and IndexedDB persistence, see the `main` branch. +A modern, no-build web application architecture using Lit web components with Zustand state management and IndexedDB persistence. ## For TSX/React Developers -If you're coming from React/TSX, here's how this minimal architecture maps to familiar concepts: +If you're coming from React/TSX, here's how this architecture maps to familiar concepts: | React/TSX Pattern | This Architecture | |-------------------|-------------------| -| `useState` | Lit's `static properties` with `state: true` | -| Props drilling | Property passing via `.prop=${value}` | -| Custom events | `CustomEvent` with `bubbles: true` | +| `useState` / `useReducer` | Zustand vanilla store | +| `useEffect` + state subscription | `StoreController` (ReactiveController) | +| Context API | Global Zustand store | +| `localStorage` / `sessionStorage` | IndexedDB via persist middleware | | JSX | Lit's `html` tagged template literals | | CSS-in-JS / CSS Modules | Lit's `css` tagged template literals | -| React Router | Simple route state in root component | +| React Router | Simple route state in store | | Build step (Vite/Webpack) | Import maps (no build!) | ### Key Differences 1. **No Virtual DOM**: Lit uses native Web Components with efficient DOM updates 2. **No Build Step**: Import maps let you use npm packages directly from CDN -3. **Local State Only**: Each component manages its own state, parent manages shared state -4. **Event-Based Communication**: Child components emit events, parent handles them -5. **Tagged Templates**: Instead of JSX, use `html\`