Skip to content

Commit

Permalink
Merge pull request #29 from BrockAltug/feature
Browse files Browse the repository at this point in the history
demonstrate React best practices with state management, props handlin…
  • Loading branch information
BrockAltug authored Jan 3, 2025
2 parents 0392d76 + 91e5de0 commit e811b5f
Show file tree
Hide file tree
Showing 3 changed files with 4,827 additions and 42 deletions.
75 changes: 55 additions & 20 deletions 16-react/16-react-forms/README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,73 @@
# 🏗️ Implement Functionality for the Forms Section
# React Project: [PROJECT TITLE]

## Activity
## Overview

Work with a partner to implement the following user story:
This project demonstrates key concepts in React development. It highlights best practices for building interactive components, managing state, and ensuring a responsive user interface.

* As a developer, I want to prevent empty input for the email and username fields of a form.

* As a developer, I want to improve the user experience by automatically clearing the input fields after the user clicks submit.
---

## Key Features

1. **State Management**:
- Utilizes React's `useState` hook for dynamic state updates.

2. **Props Handling**:
- Passes data between components using React props for reusability and flexibility.

3. **Validation and Error Handling**:
- Implements input validation and error messages for enhanced user experience.

4. **Event Handling**:
- Leverages React's event handling to manage user interactions like form submissions and button clicks.

5. **Responsive Design**:
- Styled with Bootstrap or CSS for a mobile-friendly and visually appealing layout.

* As a developer, I want to make the application more robust by adding a password input field.
---

## Concepts Covered

* As a developer, I want to ensure that the email and password provided by the user are valid.
1. **useState Hook**:
- Learn how to manage component state and trigger re-renders dynamically.

## Acceptance Criteria
2. **Props**:
- Understand how to pass data and functions between parent and child components.

This activity is complete when the following criteria are met:
3. **Input Handling**:
- Practice controlled components and manage input state effectively.

* It's done when I have created a state variable, `password`.
4. **Form Validation**:
- Explore strategies to validate user input and provide feedback.

* It's done when I have added a condition to check if the input type is `password` and to update state using `setPassword`.
5. **Dynamic Rendering**:
- Build components that render dynamically based on application state or props.

* It's done when I have used the methods in the `helper.js` file to validate the format of the email and the strength of the password.
---

* It's done when I have set the input fields back to empty strings after the user clicks submit.
## Setup Instructions

* It's done when I have added a new input field in the return statement with `name`, `type`, `placeholder`, `value`, and `onChange` attributes.
1. **Install Dependencies**:
- Run `npm install` to install React and any necessary dependencies.

## 🏆 Bonus
2. **Run the Application**:
- Start the application using:
```bash
npm start
```

If you have completed this activity, work through the following challenge with your partner to further your knowledge:
3. **View the Application**:
- Open [http://localhost:3000](http://localhost:3000) in your browser.

* How could we have implemented basic form validation without using helper functions?
---

Use [Google](https://www.google.com) or another search engine to research this.
## Expected Behavior

1. The application behaves dynamically based on user inputs or interactions.
2. Real-time updates and error feedback are provided to improve usability.
3. Components are reusable and maintainable.

---
© 2024 edX Boot Camps LLC. Confidential and Proprietary. All Rights Reserved.

## Summary

This project demonstrates React best practices and foundational concepts such as state, props, and event handling. It provides a strong base for building interactive and responsive web applications.
Loading

0 comments on commit e811b5f

Please sign in to comment.