Mission: Build and deploy your first React + TypeScript web app that manipulates text.
β± Time: 1-2 hours
π― Goal: Ship a working Mini Text Toolkit with three features: Reverse Text, Word Count, and Title Case.
Before starting this lab, ensure you have:
- β
Node.js 18+ installed (
node -v) - β
pnpm installed (
pnpm -v) - β
Git configured (
git config --list) - β
Firebase CLI installed and logged in (
firebase login) - β VS Code with ESLint & Prettier extensions
If you haven't set these up yet, refer to PART A of the lab instructions.
week1-lab-text-tools/
βββ src/
β βββ App.tsx # Main React component (UI structure)
β βββ App.css # Component styles
β βββ main.tsx # React entry point
β βββ index.css # Global styles
β βββ utils/
β βββ textTools.ts # β οΈ YOUR CODE GOES HERE
βββ index.html # HTML template
βββ package.json # Dependencies & scripts
βββ tsconfig.json # TypeScript config (strict mode)
βββ firebase.json # Firebase Hosting config
βββ README.md # This file
pnpm installThis will install all required packages (React, TypeScript, Vite, etc.)
pnpm devOpen http://localhost:5173 in your browser.
You'll see the UI is ready, but the buttons don't work yet. That's your job! β¨
Open src/utils/textTools.ts and implement these three functions:
export function reverseText(input: string): string {
// TODO: Implement this
// Hint: Use split(''), reverse(), and join('')
}Example:
- Input:
"hello"β Output:"olleh" - Input:
"Code Camp"β Output:"pmaC edoC"
export function countWords(input: string): number {
// TODO: Implement this
// Hint: Use trim(), split(/\s+/), and filter(Boolean)
}Example:
- Input:
"hello world"β Output:2 - Input:
" "β Output:0 - Input:
"Code Camp 2024"β Output:3
export function toTitleCase(input: string): string {
// TODO: Implement this
// Hint: Split by spaces, capitalize first letter of each word, then join
}Example:
- Input:
"hello world"β Output:"Hello World" - Input:
"code camp week 1"β Output:"Code Camp Week 1"
After implementing the functions:
-
Manual Testing:
- Go to http://localhost:5173
- Type some text in the textarea
- Click each button and verify the output
-
TypeScript Check:
pnpm typecheck
Should show no errors β
-
Linting:
pnpm lint
Should show no warnings β
-
Format Code:
pnpm format
pnpm buildThis creates an optimized build in the dist/ folder.
First, update .firebaserc with your Firebase project ID:
{
"projects": {
"default": "cc-yourname-week1"
}
}firebase deployAfter deployment, you'll see:
β Deploy complete!
Project URL: https://cc-yourname-week1.web.app
Visit that URL and test your live app! π
Before submitting, ensure:
- All 3 features work correctly (Reverse, Count, Title Case)
-
pnpm typecheckpasses with no errors -
pnpm lintpasses with no warnings - App is deployed to Firebase and accessible via public URL
- Footer shows your name (edit
App.tsxline 49) - README updated with your info (see below)
Replace the sections below with your own information:
## π€ Student Info
**Name:** [Your Full Name]
**Cohort:** [Your Cohort Name]
**Live Demo:** [Your Firebase URL]
## π― What I Learned
1. [Something you learned about React]
2. [Something you learned about TypeScript]
3. [Something you learned about deployment]If you finish early, try adding:
- Character Count below the textarea (live counter)
- Copy to Clipboard button for the output
- Clear Text button to reset both input and output
- Dark Mode toggle (use CSS variables)
Fix: Run pnpm install
Fix: Ensure you're using proper types. The textarea is already typed correctly in App.tsx
Fix:
- Check browser console for errors
- Verify
firebase.jsonhas"public": "dist" - Make sure you ran
pnpm buildbefore deploying
Fix: You haven't implemented the logic yet! Open src/utils/textTools.ts and write the code.
| Category | Points | Criteria |
|---|---|---|
| Functionality | 40% | All 3 features work correctly |
| Code Quality | 25% | TypeScript strict mode, ESLint clean, proper naming |
| Deployment | 20% | Live Firebase URL accessible |
| Documentation | 15% | README updated, clear commit messages |
Total: 100 points
Name: [Your Full Name]
Cohort: [Your Cohort Name]
Live Demo: [Your Firebase URL]
GitHub Repo: [Your forked repo URL]
- [Add your learnings here after completing the lab]
This lab is part of Code Camp by SCC. For educational purposes only.
π¬ "Your first deployed React app starts here. Make it count!"
β Code Camp by SCC