How yukionishi1129/lesson-react-202109 works
Project type and purpose
• This is a client-side single-page application (SPA) built with Create React App.
• There is no dedicated backend or database folder—everything lives in the “public” and “src” directories, and all logic runs in the browser.
File structure
• Top-level artifacts:
• package.json – declares dependencies (react, react-dom, react-scripts) and build/test scripts.
• public/ – static assets served as-is (index.html, manifest.json, robots.txt).
• src/ – React source code, CSS, tests, and app entrypoint.
• src/ breakdown:
• index.js – React application bootstrap (renders <App /> into the DOM).
• App.js / App.css – main application component and styles.
• components/ – two input components (InputClass.jsx, InputFunc.jsx) and their CSS.
• setupTests.js, reportWebVitals.js, App.test.js – test harness and performance logging.
• Build & deployment: Managed entirely by react-scripts (Webpack+ Babel) via yarn start, build, test.
Readme insights
• Confirms use of Create React App.
• Standard development workflow: dev server with hot reload, production build output to build/.
• No mention of custom server side or external APIs.
Main components
a. User’s Web Browser (Client)
b. Static Hosting Server (e.g., Netlify, GitHub Pages) or local dev server (Webpack Dev Server)
c. React Build Pipeline:
• Node.js + npm/yarn
• react-scripts (Webpack, Babel)
d. Application Root: index.html + Bundled JS/CSS
e. React Component Hierarchy:
• App
• InputClass
• InputFunc
f. Testing & Instrumentation (Jest, react-testing-library, reportWebVitals)
Relationships & data flow
• Browser requests index.html from the hosting server.
• Bundled JS & CSS are delivered.
• index.js mounts the React tree into a div#root.
• User interactions flow down via props/state, component re-renderings flow up.
• Tests run against src/ via Jest in Node.
• reportWebVitals collects performance metrics and can send to an analytics endpoint.
Architectural patterns & design principles
• Component-based UI: each React component encapsulates its own markup, style, and logic.
• Unidirectional data flow: parent <App /> passes props down to InputClass/InputFunc; child components notify parent via callbacks.
• Build abstraction: react-scripts hides Webpack/Babel config until you eject.
Technologies & frameworks
• React, React DOM
• Webpack (via react-scripts)
• Babel for ES6+ transpilation
• Jest and react-testing-library for tests
• CSS modules (plain .css files)
• reportWebVitals for performance metrics
Detail without over-splitting
• Major piece (Dev Server vs. Prod Build vs. Browser).
• Within the browser, show only the top-level React components rather than every single file.
• Tests and performance logging as side processes.