GithubHelp home page GithubHelp logo

hackerrank-reactjs-sort's Introduction

React: Sorting Articles

Create a basic article sorting application, as shown below. Some core functionalities have already been implemented, but the application is not complete. Application requirements are given below, and the finished application must pass all of the unit tests.

sorting-app

The app has one component named Articles. The list of articles to be displayed is already provided in the app.

The app must have the following functionalities:

  • The list of articles is passed to the App component as a prop in the form of an array of objects.
  • Each article has the following three properties:
    • title: The title of the article [STRING]
    • upvotes: The number of upvotes for an article [NUMBER]
    • date: The publish date for the article in the format YYYY-MM-DD [STRING]
  • By default, the articles should be displayed in the table ordered by the number of upvotes in descending order.
  • Clicking on the "Most Upvoted" button should reorder and display the articles by the number of upvotes in descending order.
  • Clicking on the "Most Recent" button should reorder and display the articles by date in descending order.
  • You can assume that each article has a unique publish date and number of upvotes.

Your task is to complete the implementation of src/App.js and src/components/Articles.js.

The following data-testid attributes are required in the component for the tests to pass:

  • The button to reorder and display the most upvoted articles must have the data-testid attribute "most-upvoted-link".
  • The button to reorder and display the most recent articles must have the data-testid attribute "most-recent-link".
  • Each article must be rendered inside a <tr> element that has the data-testid attribute "article".
  • The title of each article must be rendered in a <td> element that has the data-testid attribute "article-title".
  • The number of upvotes of each article must be rendered in a <td> element that has the data-testid attribute "article-upvotes".
  • The publish date of each article must be rendered in a <td> element that has the data-testid attribute "article-date".

Environment

  • React Version: 16.13.1
  • Default Port: 8000

Project Specifications

Read-Only Files

  • src/App.test.js

Commands

  • run:
npm start
  • install:
npm install
  • test:
npm test

hackerrank-reactjs-sort's People

Contributors

tommyleong avatar

Watchers

 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.