This is a simple React application that allows users to input usernames and ages, and then displays the list of users with their corresponding age. The app ensures form validation for both the username and age entry using the useReducer hook to manage related states. Additionally, it uses ReactDOM.createPortal to display an error modal if the user leaves any field empty.
User Input: The app allows users to enter their username and age in separate input fields.
Form Validation: The app checks for empty fields and displays an error modal when either the username or age is left empty.
User List: Once the user successfully enters both the username and age, the app displays the list of users along with their corresponding ages.
Error Modal: In case of empty fields, an error modal is shown using ReactDOM.createPortal, which overlays the main content and alerts the user about the empty fields.
-
Clone the repository
-
Install dependencies: npm install or yarn install
-
Run the app: Use npm start or yarn start to start the development server and view the app in your web browser.