Mi App Números is a single-page React application with a flat component architecture — all views are defined as functions insideDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/jonathino2590/mi-app-numeros/llms.txt
Use this file to discover all available pages before exploring further.
App.jsx and rendered conditionally based on the view state variable. There are no separate route files or page-level components; the entire application lives within a single component tree, making it easy to trace data flow from top-level state down to each view.
Directory Layout
Entry Point
The application boots through a three-file chain:index.html— The HTML shell served by Vite. It contains a single<div id="root"></div>and a<script type="module" src="/src/main.jsx">tag that kicks off the JavaScript bundle.src/main.jsx— ImportsAppand mounts it into the#rootdiv using React 19’screateRootAPI, wrapped in<StrictMode>for development warnings. It also importsindex.css, which contains the three Tailwind CSS directives.src/App.jsx— The root component that owns all application state, data, navigation logic, and nested view components.
src/main.jsx
App.jsx Architecture
TheApp component is the sole top-level component in the application. It is responsible for four concerns:
Static data — NUMBERS_DATA
A constant array of 11 objects defined at the module level (outside the component). Each entry describes one number with four properties: val (integer), word (Spanish name), emoji (visual representation), and color (Tailwind background class). All views loop over this array to render their content.
src/App.jsx (data)
| State variable | Type | Purpose |
|---|---|---|
view | string | Controls which view is rendered ('menu', 'learn', 'practice', 'write') |
currentIndex | number | Index into NUMBERS_DATA for the active number |
gameMode | string | 'linear' (sequential) or 'random' (shuffled) |
feedback | string | null | 'correct', 'wrong', or null (no overlay) |
stars | number | Cumulative correct-answer count shown in the nav |
startLearning(mode)— SetsgameMode, resetscurrentIndexto0, and switchesviewto'learn'.nextNumber()— AdvancescurrentIndex(or picks a random one in random mode) and clearsfeedback. Returns to'menu'when the last number in linear mode is reached.handleCorrect()— Setsfeedbackto'correct', incrementsstars, then callsnextNumber()after a 1.5-second delay.
App, giving them closure access to state and navigation functions without prop drilling:
| Component | Purpose |
|---|---|
Menu | Landing screen with “Paso a Paso” and “Modo Aleatorio” buttons and the star counter |
LearnView | Displays the current number, its Spanish name, and an animated emoji grid; links to PracticeView and WritingView |
PracticeView | Multiple-choice quiz — shows emojis and asks the user to pick the correct digit from three randomized options |
WritingView | Free-draw canvas with a ghost number guide; uses useRef and the Canvas 2D API for touch and mouse input |
App renders two persistent UI elements:
- A
<nav>bar fixed at the top with a Home button (returns to'menu') and the live star counter. - A feedback
<AnimatePresence>block that overlays a full-screen ✅ or ❌ animation wheneverfeedbackis non-null.
View Switching
Theview state variable is the single source of truth for which screen the user sees. The main <AnimatePresence mode="wait"> block renders only the matching view component at any time, and Framer Motion handles the enter/exit animations between transitions:
src/App.jsx (view switcher)
key so that AnimatePresence can detect when the active child changes and run the correct exit animation before mounting the next view.