Coder Social home page Coder Social logo

chippychoppy / module-4-practice-bookliker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from learn-co-curriculum/module-4-practice-bookliker

0.0 0.0 0.0 15.04 MB

React version of the Mod 3 practice challenge

HTML 28.85% JavaScript 69.74% CSS 1.41%

module-4-practice-bookliker's Introduction

Practice Challenge

You may remember this challenge from Mod 3!
This one is the React version - might look a bit different to the gif below, as we've used Semantic UI to style. Have a think about what components you'll need to recreate Bookliker in React...what will you need to keep track of in state?

Getting Started

You will be using the json-server package to mock an external API. You can make the same RESTful requests to this server that you would to any API. If you haven't yet, install json-server.

npm install -g json-server

Then run the server with:

json-server db.json

This will serve your code on http://localhost:3000.

Build the following application in React

This React version uses the Semantic UI library for styling and structure.

You will be using the following backend to get the list of books. The expectation here is that you will include the following features

  • Get a list of books & render them http://localhost:3000/books
  • Be able to click on a book, you should see the book's thumbnail and description and a list of users who have liked the book.
  • You can like a book by clicking on a button. You are user 1 {"id":1, "username":"pouros"}, so to like a book send a PATCH request to http://localhost:3000/books/:id with an array of users who like the book. This array should be equal to the existing array of users that like the book, plus your user. For example, if the previous array was "[{"id":2, "username":"auer"}, {"id":8, "username":"goodwin"}], you should send as the body of your PATCH request:
{
  "users": [
    {"id":2, "username":"auer"},
    {"id":8, "username":"goodwin"},
    {"id":1, "username":"pouros"}
  ]
}
  • This route will respond with the updated book json including the list of users who have liked the book.
  • BONUS: Can you make it so a second patch request to the same book removes your user from the list of users? Can you toggle likes on and off?

module-4-practice-bookliker's People

Contributors

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