Students will practice creating and combining React components to build a basic static application.
Use Vite to scaffold a new React project:
npm create vite@latest
Project Name: static-todo-react-app
Framework: React
Variant: JavaScript
Navigate into the project directory:
cd static-todo-react-app
Run the following command to install all required packages:
npm install
Run the following command to start your local development server:
npm run dev
Navigate to the following URL to view your application:
http://localhost:5173
Inside the src
directory, create a folder named:
components
Create a functional component called ToDoList
.
Inside this component:
- Define an array of static tasks (e.g.,
"Learn React"
,"Build a project"
,"Read documentation"
). - Manually add a list:
<ul>
<li>Learn React</li>
<li>Build a project</li>
<li>Read documentation</li>
</ul>
Create a functional component called Header
.
Inside this component:
- Render a simple heading:
<h1>My To-Do List</h1>
Import the Header
and ToDoList
components into App.jsx
.
Place the <Header />
at the top of the app.
Add the <ToDoList />
below the header.
Add basic styles to make the app visually appealing.
Center the content using:
text-align: center;
- Custom bullet points or spacing
- Padding and margin for layout
- Font and color choices
- Add hover effects on tasks
- Use a custom font for list text
A functional React app that displays:
- A heading that says: My To-Do List
- A static list of tasks:
- Learn React
- Build a project
- Read documentation
Heading:
My To-Do List
• Learn React
• Build a project
• Read documentation