How ydnarf/calculator works
Project type and purpose
• This is a single‐page application (SPA) built with React that exposes a simple calculator UI in the browser.
• Purpose: allow users to perform basic arithmetic operations (addition, subtraction, multiplication, division) with an intuitive, responsive interface.
File structure
• Top level:
• index.html – entry point served to the browser
• src/ – all React source code
– App.jsx – root component
– componentes/ – reusable UI components (Boton, BotonClear, Pantalla)
– styles/ – per‐component CSS files
– main.jsx – ReactDOM.render (mount app)
• public/ – static public assets
• config files: package.json, vite.config.js, eslint.config.js
Key insights from the README
• Uses React with useState for state management
• Fully responsive design
• Deploys as a static site (e.g., Netlify link provided)
• No backend or external services
Main components and interactions
a. Components
1. Browser UI
2. Static hosting/CDN (Netlify or similar)
3. React bundle (JS/CSS)
4. React root component (App)
5. Child components:
– Pantalla: displays input and result
– Boton: digit/operator button
– BotonClear: clear button
6. State store (React useState inside App)
b. Relationships / data flow
• User clicks Boton ⇒ onClick handler passed from App ⇒ App updates state
• State flows down via props to Pantalla for rendering
• BotonClear click resets App state
• App → re‐renders children with new state
c. Architectural patterns / design principles
• Component‐based architecture (separation of concerns)
• Unidirectional data flow (parent manages state, children emit events)
• CSS modularity: each component has its own stylesheet
d. Technologies / frameworks
• React (JSX, useState hook)
• Vite (build & dev server)
• HTML5 / CSS3
• Netlify (static hosting/CDN)
Detailed callouts
• Hook usage (useState) inside App
• Call out “Vite Dev Server / Build” step for local development
• “Netlify CDN” as the deployment target