Coder Social home page Coder Social logo

whack-a-mole's Introduction

Whack-A-Mole

Two factors determine what a React Component renders:

  1. Props - properties passed into the component from it's parent.
  2. State - the internal state of a component

If you haven't already, read the React docs to get a better sense of these two concepts.

In this challenge, we'll be building a Whack-A-Mole game - this exercise will serve as a gentle introduction to state and props.

Note: Make sure to run npm install from the app's root to get the necessary node modules on your local machine.

The game "engine" has already been created. The state of the top-level component, App.js, contains two items:

  1. dens - an array of objects that are a representation of the "holes" in the whack-a-mole game.
  2. points - an integer that contains the number of times a mole was whacked/clicked.

Inspect App.js and attempt to understand the game engine logic - this may help you in achieving the objectives.

Release 0

  • Modify the props that are passed into Mole.js and the Mole.js component itself so that the Mole image only appears when the isMoleVisible property of the appropriate den object is set to true.

Release 1

  • Modify Mole.js so that points are incremented whenever a visible mole is clicked.
  • Add comments to the startGame(), getDensState(), and onMoleWhacked() functions that explain what the code is doing.

whack-a-mole's People

Contributors

mic-j-lee avatar jyoung217 avatar adamziolk avatar chad-mowbray avatar karaajc 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.