Coder Social home page Coder Social logo

react-hooks-state-events-pairing's Introduction

React State and Events Pairing

Learning Goals

  • Train yourself to Think in React
  • Design components based on a mockup
  • Pass down data to components via props
  • Handle user interaction via events
  • Use state to trigger changes in the DOM

Setup

Fork and clone this lab. Then, cd into the lab directory and run:

npm install
npm start

This will install all the dependencies and run the application in your browser at http://localhost:3000.

Deliverables

Your goal is to build this app from scratch:

demo

The application has the following features:

  • When the app loads, display a video along with its details and a list of all the comments
  • When a user clicks on the "๐Ÿ‘" button, the number of upvotes for the video should increase
  • When a user clicks on the "๐Ÿ‘Ž" button, the number of downvotes for the video should increase
  • When the user clicks the "Hide Comments" button, the comments should be removed from the page, and the button text should change to "Show Comments". When the button is clicked again, it should toggle back to showing the comments.

The data you'll need for the app can be found in the video.js file.

Start by planning out what components you'll need and draw out your component hierarchy. Then, build out your components and pass down any data they need via props using the video object that's been imported in the App component.

Consider what components need to use state as you're building out these features.

There's an example of how to embed a video using an <iframe> in the App component. Other than that, you're on your own in terms of how to design each part of the application. Don't worry too much about getting the styling to match the demo. Focus on functionality.

Good luck!

Bonus

If you finish early and want to get more practice with state and events, here are some ideas for additional features:

  • Add upvote/downvote buttons to each comment
  • Add a search bar to search comments by username
  • Add a "Remove Comment" button to delete comments from the page
  • Add a sorting feature to sort the comments

react-hooks-state-events-pairing's People

Contributors

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