How trantuananh1/todo-list works
Project Type and Purpose
• This is a single‐page application (SPA) built with Create React App.
• It implements a “Todo” UI component library plus app logic, all running in the browser.
High-Level Architecture Components
a. Static Hosting Layer
• public/index.html, manifest.json, robots.txt, static assets
• Served by a CDN or static file server (e.g., Netlify, GitHub Pages)
b. Bundling & Build Process
• package.json scripts (npm start, npm run build)
• Webpack/Babel under the hood (hidden until you eject)
c. Client-Side React Application
• src/index.js – application entry point; renders <App/> into the DOM
• src/App.jsx – root component
• src/reportWebVitals.js – optional metrics reporting
d. Todo Feature Module
• src/components/Todo/useTodo.js – custom hook for state & persistence
• src/components/Todo/Wrapper.js – container component orchestrating the UI
• src/components/Todo/Header.js – UI for adding/filtering todos
• src/components/Todo/Item.js – single todo item representation
• src/components/Todo/Footer.js – summary and controls (e.g., clear completed)
• src/components/Todo/css/style.css – visual styling
Relationships & Data Flow
• On page load, the Static Hosting Layer returns index.html + JS bundle → Browser.
• Browser executes bundle → React app initializes in
.
• <App/> mounts and delegates to <TodoWrapper/>.
• <TodoWrapper/> calls useTodo() to load and manage state (in-memory + localStorage).
• Child components (Header, Item list, Footer) receive state & dispatch functions via props.
• User actions (e.g., “add todo”) flow up through event handlers → useTodo state updater → React re-render.
• reportWebVitals can optionally send metrics to an analytics endpoint.
Architectural Patterns & Principles
• Component-based architecture: clear separation of concerns per UI piece.
• Custom hook (useTodo) encapsulates stateful logic and persistence.
• Unidirectional data flow: parent → child props, child → parent via callbacks.
• Use rectangles for modules/components.