React Demo App
A comprehensive React application showcasing various features including routing, form handling, and component organization.
Features
- React Router navigation
- Form handling and validation
- Price calculator with discount types
- Character attributes management
- Focusable input component
- Item list management
- Todo list functionality
- Comprehensive test suite
Tech Stack
- React 19
- React Router v7
- Vite 6
- Vitest (Testing)
- React Testing Library
- ESLint
- pnpm (Package Manager)
Getting Started
Prerequisites
- Node.js (latest LTS version recommended)
- pnpm package manager
Installation
- Clone the repository
- Install dependencies:
pnpm install
Available Scripts
pnpm dev- Start development serverpnpm build- Build for productionpnpm preview- Preview production buildpnpm test- Run tests in watch mode (auto-reruns on file changes)pnpm test:run- Run tests once and exitpnpm test:ci- Run tests in CI environmentpnpm test:ui- Run tests with UI interfacepnpm coverage- Generate test coverage reportpnpm lint- Run ESLint
Project Structure
src/
├── assets/ # Static assets
├── data/ # Data files
├── form/ # Form-related components
├── pages/ # Page components
├── test/ # All test files (unit and integration)
├── testdome/ # TestDome specific components
├── App.jsx # Main application component
├── CharacterAttributes.jsx # Character attributes component
├── Contact.jsx # Contact page component
├── Contact2.jsx # Alternative contact page
├── FocusableInput.jsx # Focusable input component
├── ItemListManager.jsx # Item list management component
├── MegaStoreApp.jsx # Price calculation component
├── TodoList.jsx # Todo list component
└── main.jsx # Application entry point
Testing
The project includes a comprehensive test suite using Vitest and React Testing Library. All test files are now located in the src/test/ directory.
Running Tests
- Development Mode: Use
pnpm testto run tests in watch mode. This is ideal for development as it automatically reruns tests when files change. - Single Run: Use
pnpm test:runto run tests once and exit. Useful for quick checks. - CI Environment: Use
pnpm test:cifor continuous integration environments. - UI Mode: Use
pnpm test:uito run tests with a graphical interface. - Coverage: Use
pnpm coverageto generate a test coverage report.
Development
This project uses Vite for fast development and building. The development server includes:
- Hot Module Replacement (HMR)
- Fast refresh
- ESLint integration
- TypeScript support (if needed)
Contributing
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request