/Cheese-SPA

A single page React application leveraging Material UI to provide responsive UI for CRUD operations through a REST API

Primary LanguageJavaScript

Cheese-SPA

This is a single page application that provides UI to perform CRUD(Create, Read, Update, Delete) operations on various resources by making AJAX calls to a Cheeses REST API.

Layout across different screens

Contents

Features

Responsive Design

Material UI library' React components are used to build the UI and provide responsive layout acrosss various screen sizes.

Asynchronicity and Error Handling

  • Cheeses, Categories and Menu lists are fetched asynchronously and loaded in correponding views. For list loading errors or empty lists, a message is displayed that notifies the user that the data cannot be loaded so that there are no negative repercussions to the UI.

  • Form validation is performed at the server side by Cheeses REST API. Appropriate error messages are populated in the form UI based on feedback form the server.

Form Validation Errors

  • The forms to add new Cheese and Menu make AJAX requests to set component state and populate drop down select fields in the forms. This asynchronous data fecthing may result in calling setState() on a form component that was closed before the AJAX call was completed which would lead to an error. To handle this situation gracefully, AbortController.abort() is used upon component unmounting which sends an abort signal to AJAX calls in progress.

Built with

  • React - A JavaScript library for building user interfaces.
  • Create React App - Creates an environment to bootstrap React applications.
  • React Router - A collection of navigational components that compose declaratively with React application.
  • prop-types - Runtime type checking for React props.
  • Fetch API - A JavaScript interface for asynchronously fetching resources.
  • AbortController API - A JavaScript interface representing a controller object that allows to abort one or more DOM requests as and when desired.
  • Material UI - MIT-licensed open source React components for faster web development.

Live Version

The live version of this app can be explored at either of the following links.