Assignment-11
Assignment-11
Scenario: At LaunchDarkly, you're responsible for building features that manage user data on a
dashboard. To handle user interactions and make the application dynamic, you will implement state
management using React's useState hook. Your task is to create a dashboard that allows users to
interact with and update their information, like changing their name, status, or theme preference.
The goal of this assignment is to help you get comfortable using the useState hook to manage state
in functional components, and to track changes in the UI based on user input.
Assignment Tasks:
cd react-user-dashboard
npm install
o Create a new component called UserDashboard that will represent the main
dashboard. This component should display:
A user's name
o Use useState to manage the name state and bind the input field to it.
o When the user types in the input field, update the state with the new name.
o As the user interacts with the dashboard, ensure the following updates:
Changing the name via the input field should immediately update the name
displayed on the dashboard.
Toggling the status should change the button text and update the displayed
status ("Active" or "Inactive").
6. Bonus (Optional):
Save the user's theme preference in localStorage so that when they return to
the page, their theme preference is remembered.
Submission:
1. src/App.jsx: The main file where you initialize and render the UserDashboard component.
2. src/UserDashboard.jsx: The component that manages the user name, status, and theme
using useState.
3. src/styles.css: The file containing the styles for the dashboard and theme.
o Describe how the user interactions (changing name, toggling status, toggling theme)
are handled dynamically.
Learning Outcomes:
Understand how to use the useState hook to manage state in functional components.
This exercise is foundational for managing local state in React, a key skill for building dynamic,
responsive user interfaces at LaunchDarkly and beyond.