GithubHelp home page GithubHelp logo

react-events-in-detail-lab-web-022018's Introduction

React Events in Detail

Overview

In this lab, you'll work with event data and persisting events.

Two Buttons To Rule Them All

Using buttons

In this lab, you'll be working on two components โ€” two buttons, to be more precise. These aren't just regular buttons, however! They both serve a very specific purpose.

CoordinatesButton

  1. In the components/CoordinatesButton.js file, create a CoordinatesButton React component.
  2. This component takes in one prop: onReceiveCoordinates. This prop is a function. (This props is only passed in the test suite, you will have errors in the browser)
  3. When the button is clicked, create an array with two elements: the X and Y coordinates of the mouse. Find these using the event data.
  4. The onReceiveCoordinates callback prop is then called with these coordinates.

DelayedButton

  1. In the components/DelayedButton.js file, create a DelayedButton React component
  2. This component takes two props: onDelayedClick (a function), and delay (a number). (These props are only passed in the test suite, you will have errors in the browser)
  3. When the button is clicked, we want to persist the event so we can pass it to the this.props.onDelayedClick() in a setTimeout() block. The setTimeout() will be set to this.props.delay.

Resources

react-events-in-detail-lab-web-022018's People

Contributors

achasveachas avatar annjohn avatar enoch2k2 avatar gj avatar kjleitz avatar lukeghenco avatar nikymorg avatar pletcher avatar thomastuts avatar

Watchers

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