GitHunt
ER

ereljapco/react-user-challenge

Solution to John Smilga's React Course user challenge where the user can add and delete persons on the list

React User Challenge

Netlify Status

This is a solution to John Smilga's User Challenge from his React 18 Tutorial and Projects Course (2023).

Table of contents

Overview

The challenge

Users should be able to:

  • Display the users from the data array
  • Add new person to the list when the user submits the form
  • Remove the person on the list when the user click on the delete button

Screenshot

My process

Built with

  • Semantic HTML5 markup
  • CSS custom properties
  • Flexbox
  • CSS Grid
  • Mobile-first workflow
  • React - JS library
  • vite-plugin-svgr - Vite plugin to transform SVGs into React components.
  • uuid - For the creation of RFC4122 UUIDs

What I learned

  • Creating a folder for each component made it easier for me to navigate and arrange my thoughts since everything for that component is in just one location

  • Use of controlled inputs instead of targetting an element's value

const [name, setName] = useState('');

function handleNameChange(e) {
  setName(e.target.value);
}
// more code here

return (
  <section className="add-user">
    <h1 className="add-user__title">Add User</h1>
    <Form name={name} handleNameChange={handleNameChange} onSubmit={onSubmit} />
    <List users={users} deleteUser={deleteUser} />
  </section>
);

Useful resources

Author

Acknowledgments

Languages

JavaScript52.4%CSS40.8%HTML6.9%

Contributors

Created February 24, 2023
Updated February 28, 2023