Giter VIP home page Giter VIP logo

craasyncjs's Introduction

CRA Async JS

Part 1: Click to Draw Card

Build an app that displays a deck of cards, one card at a time.

  1. At page load, create new deck and show button that draws a card.
  2. Every clock, display a new card until there are no cards left in the deck.
  3. If there are no cards remaining, an alert should appear with the text “Error: no cards remaining!”.

Do not focus on CSS at all.

Part 2: Shuffle The Deck

Add a button that will shuffle the deck to start drawing from a full deck without refreshing the page.

  1. Make a call to the cards api to shuffle the existing deck.
  2. The button should not be clickable while the shuffle is in progress.
  3. The shuffle should remove all of the cards from the screen.

Further Study

Style app and change the behavior so that clicking on the draw card button will draw one card every second.

  1. These draws will continue until you press the button again, or until the deck has been exhausted (at which point the alert message from Part 1 should appear).
  2. Change the button text appropriately i.e. it could toggle between “Start drawing” and “Stop drawing.”

Investigate the useRef hook to manage a setInterval call.

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.