Git Product home page Git Product logo

checkpoint-react-14-june's Introduction

Getting started:

Fork, then clone this repository and run

npm install

Inside the repository.

Run:

npm run dev

This will start your react app. React app will run on localhost:3000.

Start editing the src/app.jsx file.

API URL: https://www.random.org/integers/?num=1&min=1&max=100&col=1&base=10&format=plain&rnd=new

You can use class components or function components for this test.

  • Create a component NumberComponent, in a new file NumberComponent.jsx. Import it in App.jsx.

  • Create a component called DisplayNumber, in a new file, that you will use inside of NumberComponent, to display the number. You can pass the number as a prop to DisplayNumber.

  • Implement a function in NumberComponent that fetches the number from an API when the component mounts.

  • Render the fetched number within the DisplayNumber, in the NumberComponent component.

  • Create a button within the NumberComponent called "Increment".

  • Implement a function that increments the value of the number when the "Increment" button is clicked.

  • Create a button in NumberComponent called "Save to LocalStorage".

  • Implement a function that saves the current value of the number to localStorage when the "Save to LocalStorage" button is clicked.

  • Create a button in NumberComponent called "Load from LocalStorage".

  • Implement a function that retrieves the saved number from localStorage and updates the value of the number when the "Load from LocalStorage" button is clicked.

  • If the number is odd, make it so the text for the number is red. If the number is even, the text is blue.

  • Use css classes, you can write them in App.css, and apply them to the text depending on the number.

  • If the number is less than 10, only display "The number is too small", otherwise display the number itself. You can write the logic for this in the DisplayNumber component.

checkpoint-react-14-june's People

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.