REACT SLIP 01 - Login Form Events
Marks: 12 | Source: original question PDF page 1
Concepts: useState, onInput, onChange, onSubmit

A. RUN THE READY PROJECT (recommended)
1. Install Node.js 22 LTS (22.12+), and VS Code. Check in terminal:
   node -v
   npm -v
2. Open the slip1 folder in VS Code (File > Open Folder).
3. Terminal > New Terminal. Make sure the terminal is inside slip1, where package.json exists.
4. Run:
   npm install
5. Run:
   npm run dev
6. Open the Local URL shown in terminal (usually http://localhost:5173/).
7. For console output, press F12 > Console in Chrome. Keep the browser and terminal open.
8. To stop the server, press Ctrl+C in the terminal.
9. Optional production compilation: npm run build
   Optional preview after build: npm run preview

B. CREATE FROM SCRATCH (exam revision)
1. Open CMD / VS Code terminal in an EMPTY parent folder, outside the ready project.
2. Create a fresh React app named react-slip-01:
   npm create vite@6 react-slip-01 -- --template react
   cd react-slip-01
   If asked to install create-vite, answer y.
3. Replace the scaffold package.json with this slip's supplied package.json (keeps the same dependencies).
   Copy the supplied index.html and entire src folder into the new project, replacing matching files.
   Copy public/ if supplied. Delete any unused scaffold files only if desired.
   This project uses Vite's built-in JSX transform with explicit React imports;
   remove the scaffold vite.config.js/ts if present (the extra plugin is not required).
4. Install dependencies:
   npm install
   Additional library commands if installing individually: None.
5. Start: npm run dev
6. Open the Local URL in browser. F12 > Console if needed.

C. FILES TO STUDY
index.html, package.json, src/main.jsx, src/App.jsx, src/index.css
Read QUESTION.txt for the original task. The primary answer code is src/App.jsx.

D. EXPECTED OUTPUT AND MANUAL CHECK
Enter demo username and password. Username typing logs onInput; password typing logs onChange. Submit -> console shows both entered values and UI shows confirmation. Empty fields are blocked by required.

E. COMMON PROBLEMS
- npm not recognized: install Node.js, then reopen VS Code.
- npm.ps1 blocked: select Command Prompt terminal or run npm.cmd install and npm.cmd run dev.
- Missing package.json: cd into the correct slip1 folder.
- Cannot find module: npm install in this project's folder.
- Port 5173 busy: use the actual Local URL printed by Vite, or stop the other server.
- No console output: open Chrome DevTools Console and clear filters.
- Do not double-click index.html; Vite serves the JSX modules.
