GithubHelp home page GithubHelp logo

der-zomber / 3-6-23-pt2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from itscodenation/flw2-u2l6-23-24-student-exercises-part-2

0.0 0.0 0.0 0 B

Home Page: replit.com/@CN-Mika/flw2-u2l6-23-24-student-exercises-part-2

JavaScript 57.21% CSS 26.28% HTML 16.51%

3-6-23-pt2's Introduction

FLW2: U2L6, Code Solo

This program should render a random number between 1 and 6 when the button is clicked.

Follow the steps below to make it work!

Take a look at the starter code:

  • How many components are there?
  • What do you think each one does?
  • How many instances of the and components are called in the component?

  1. Go to the handleClick function inside of the component. This function is what will generate a random number between 1 and 6 (that's what the variable randomNumber is for!).

    • Update the code inside the function so that the value of the state variable roll will be the same as whatever random number is generated.
    • Hint: You will have to use the setter function!

  1. Now go to the <Button /> component. Replace "null" with a prop. This will allow us to pass a function to the button tag so that the number will change when the button is clicked.

    • Rembember to give the prop a name!

  1. Finally, go to the component. Pass the handleClick() to the instance of the <Button /> component.

    • Now when the user clicks the button, a random number between 1 and 6 should appear above it.

3-6-23-pt2's People

Contributors

cn-mika 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.