JavaScript Basics Task: Build a Simple Data Dashboard
Objective:
Students will practice fundamental JavaScript concepts, including data types, functions, Array.map, and function calls, by building a simple data dashboard using React and Vite.
Task Overview:
Students will create a React project that displays a list of users and their information using data from an array. They will use JavaScript functions to manipulate the data and render it dynamically on the page.
Requirements:
1. Set Up the Project:
Create a React project using Vite:
Run npm create vite@latest to create a new React project.
Set up the project and install dependencies with npm install.
Start the development server using npm run dev.
2. Data Types:
Create an array of objects:
Inside a data.js file, create an array of objects representing users. Each object should have properties like name (string), age (number), and occupation (string).
JavaScript Basics Task: Build a Simple Data Dashboard
Objective:
Students will practice fundamental JavaScript concepts, including data types, functions,
Array.map
, and function calls, by building a simple data dashboard using React and Vite.Task Overview:
Students will create a React project that displays a list of users and their information using data from an array. They will use JavaScript functions to manipulate the data and render it dynamically on the page.
Requirements:
1. Set Up the Project:
npm create vite@latest
to create a new React project.npm install
.npm run dev
.2. Data Types:
data.js
file, create an array of objects representing users. Each object should have properties likename
(string),age
(number), andoccupation
(string).3. Functions:
users
array and returns a formatted string of each user’s name and occupation.4.
Array.map
:.map()
to render the user list:Array.map()
function to loop through theusers
array and display each user's formatted details.5. Function Call:
formatUser()
is called from within the React component to display the user information dynamically.6. Final Output:
Render the UserList component:
App.js
file, render theUserList
component, which will display the formatted user details.Project Structure:
formatUser
.