Git Product home page Git Product logo

phase-2-practice-cc-duck-manager-react-edition's Introduction

Phase 2 Practice Code Challenge - Duck Manager 2022 - React Edition

To get started, fork and clone the repository and run npm install followed by npm run server. In a seperate terminal, run npm start.

Endpoints: You have access to all the ducks at http://localhost:4001/ducks.

Deliverable One

Fetch all the ducks from the db.json and use .map in order to show a DuckListCard for each of them in the DuckList. State has already been built for you for this one...

Deliverable Two

When a DuckListCard is clicked, it becomes the featuredDuck in state. The featuredDuck details are shown in the DuckDisplay component.

Deliverable Three

When the button that says Open Duck Form is clicked, it will toggle whether the DuckForm is displayed or not. Use best practices with conditional rendering to show it. Additionally, the button should either read Open Duck Form or Close Duck Form depending on whether the form is already opened or closed.

Deliverable Four

In the duck detail, the number of likes should increment whenever the likes button is clicked.

Deliverable Five

When the number of likes increments, send a PATCH request to edit the duck in the backend.

Example request:

fetch(`http://localhost:4001/ducks/2`, {
  method: 'PATCH',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({likes: 4})
})

Deliverable Six

Make the DuckForm a controlled form. When submitted, a new duck gets posted to the db.json.

Example request:

fetch(`http://localhost:4001/ducks`, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({name: "Sir Quackington", image_url: "http://ducks.com/duckington.jpg", likes: 0})
})

Assume ducks start with 0 likes.

phase-2-practice-cc-duck-manager-react-edition's People

Contributors

brewchetta 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.