GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - GoIT-Homeworks/goit-react-hw-07: This project is a Phonebook application built with React, Redux Toolkit, and Vite. The main goal of this homework is to practice asynchronous operations, Redux Toolkit with createAsyncThunk, remote backend integration, and state optimization with memoized selectors.

BranchesTags
Open more actions menu

Latest commit

 

History

15 Commits
15 Commits

Folders and files

NameName
Last commit message
Last commit date
public
public
 
 
src
src
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
eslint.config.js
eslint.config.js
 
 
index.html
index.html
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
vite.config.js
vite.config.js
 
 

Repository files navigation

šŸ“’ React Homework 07 — Phonebook Application

This project is a Phonebook application built with React, Redux Toolkit, and Vite. The main goal of this homework is to practice asynchronous operations, Redux Toolkit with createAsyncThunk, remote backend integration, and state optimization with memoized selectors.


šŸ”— Project Links

  • GitHub Repository: https://github.com/YOUR_USERNAME/goit-react-hw-07
  • Live Demo (Vercel): https://YOUR_PROJECT.vercel.app

šŸ› ļø Technologies Used

  • React
  • Vite
  • Redux Toolkit
  • createAsyncThunk
  • Axios
  • Formik & Yup
  • CSS Modules
  • mockapi.io (REST API backend)

šŸ“Œ Application Description

This application allows users to manage a list of contacts. All contacts are stored on a remote backend created with mockapi.io.

Main features include:

  • Fetching contacts from a backend API
  • Adding new contacts
  • Deleting existing contacts
  • Filtering contacts by name
  • Loading and error handling
  • Optimized filtering using memoized selectors

🧠 State Management

State management is implemented using Redux Toolkit. The global state structure follows the required format:

{
  contacts: {
    items: [],
    loading: false,
    error: null
  },
  filters: {
    name: ""
  }
}

Redux Persist was completely removed. All data is now fetched from and synchronized with the backend.


šŸ”„ Async Operations

All HTTP requests are implemented using createAsyncThunk and axios inside contactsOps.js.

  • fetchContacts — GET /contacts
  • addContact — POST /contacts
  • deleteContact — DELETE /contacts/:id

Each async operation handles three states: pending, fulfilled, and rejected, which are processed inside extraReducers.


⚔ Performance Optimization

After adding loading and error states, contact filtering could re-run unnecessarily. To solve this, a memoized selector was implemented using createSelector.

The selector selectFilteredContacts depends only on:

  • The contacts list
  • The current name filter

This selector is used directly inside ContactList.jsx with useSelector.


šŸ“‚ Project Structure

src/
ā”œā”€ā”€ assets/
│   ā”œā”€ā”€ react.svg
│   └── react 2.svg
ā”œā”€ā”€ components/
│   ā”œā”€ā”€ Contact/
│   │   ā”œā”€ā”€ Contact.jsx
│   │   └── Contact.module.css
│   ā”œā”€ā”€ ContactForm/
│   │   ā”œā”€ā”€ ContactForm.jsx
│   │   └── ContactForm.module.css
│   ā”œā”€ā”€ ContactList/
│   │   ā”œā”€ā”€ ContactList.jsx
│   │   └── ContactList.module.css
│   └── SearchBox/
ā”œā”€ā”€ redux/
│   ā”œā”€ā”€ contactsOps.js
│   ā”œā”€ā”€ contactsSlice.js
│   ā”œā”€ā”€ filtersSlice.js
│   ā”œā”€ā”€ store.js
ā”œā”€ā”€ App.jsx
ā”œā”€ā”€ App.css
ā”œā”€ā”€ index.css
└── main.jsx

šŸš€ Application Initialization

When the application loads, contacts are fetched from the backend inside the App component using useEffect and dispatch(fetchContacts()).

The application runs without console errors or warnings and fully satisfies all homework requirements.


āœ… Final Notes

This homework focuses on real-world Redux patterns, clean async logic, backend communication, and performance optimization using memoized selectors.

Happy coding! šŸš€

About

This project is a Phonebook application built with React, Redux Toolkit, and Vite. The main goal of this homework is to practice asynchronous operations, Redux Toolkit with createAsyncThunk, remote backend integration, and state optimization with memoized selectors.

goit-react-hw-07-sooty-phi-55.vercel.app

Topics

asynchronous-programmingbackend-integrationcreateasyncthunkmemoized-selectorsreactredux-toolkitstatevite

Resources

Readme
MIT license
Activity
Custom properties

Stars

1 star

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800Ɨ600. No cookies required.