Code Monkey home page Code Monkey logo

web-asyncredux1-guided-project's Introduction

How to Run this App

  • Clone repository.
  • Run npm install or yarn install.
  • Run npm run dev or yarn run dev.
  • Run npm test or yarn test.
  • Serve index.html using live-server or similar.

Objectives

  • Learn to use Redux Thunk.

Requirements

We need node & npm, as well as packages live-server and eslint installed globally. VSCode's eslint extension is recommended. Command line commands are run inside the project folder. This guide uses npm but should work the same using yarn.

Necessary enppoints

  • We need working enpoints on mockable.io or similar:
  • GET /quotes endpoint, serving quotes:
      [
        {
          "id": "7b3f21c5-ff79-4982-b3b7-397ac4a7344b",
          "author": "Dr. Seuss",
          "text": "Don't cry because it's over, smile because it happened."
        },
        {
          "id": "48ec2a41-1c67-49f4-ba14-a49907ef02ce",
          "author": "Frank Zappa",
          "text": "So many books, so little time."
        },
        {
          "id": "ee0315da-f2af-40d4-8990-7097e28a08c4",
          "author": "Oscar Wilde",
          "text": "Be yourself; everyone else is already taken."
        }
      ]
  • POST /quotes endpoint, expecting a request body of this shape:
      {
        "author": "Gabriel",
        "text": "Postman first."
      }
  • and returning the newly created quote:
      {
          "id": "86332fbe-2d02-4a16-afb0-9b7f0a67d324",
          "author": "Gabriel",
          "text": "Postman first."
      }
  • DELETE /quotes/{id}, expecting an id param of the quote to be deleted
  • and returning the id of the deleted quote in this form:
      {
          "id": "{{id}}",
      }

Steps

  • Students should test the endpoints on Postman.
  • Walk students through the structure of the project.
  • Walk students through App.jsx to see how redux-thunk is plugged in.
  • Show students the action types related to the spinner inside .
  • Have students build a reducer for spinner slice of state.
  • Have students include the new reducer in the redux store.
  • Ask students to fix the Spinner component (needs CSS and connecting to the store).
  • Demonstrate [GET]ing quotes and handling the data with "normal" action creators.
  • Get to work on the async action creators.
  • Fix Quotes.jsx.
  • Fix Quote.jsx.
  • Fix QuoteForm.jsx.
  • Demonstrate redux-form.

web-asyncredux1-guided-project's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.