Coder Social home page Coder Social logo

dhanteyud / data-filter Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 361 KB

๐Ÿš€ A simple react app that filters data with a specific filter component and also can be searched through with a search box or #tag

HTML 8.74% JavaScript 59.77% CSS 31.48%
graphql react react-jsx data-filtering graphql-api

data-filter's Introduction

Data-Filter

A simple react app that filters data with a specific filter component and also can be searched through with a search box or #tag.

  1. cd data-filter

  2. Run npm install to install dependencies

  3. Run npm start to start app

Click on this Link to view demo app

1. React Hooks used:

  • useState
  • useEffect

2. GraphQL API used:

https://api.spacex.land/graphql/

3. Data is filtered by:

  • Searching data via search box

  • Clicking any of the filter buttons and searching data via search box filters data based on that header

  • Clicking any of the #tags for a quick filter

    How it works:

    Each filter button has an onClick function which updates the data state. In order to call this function onChange when a user enters a search word, a header is being passed and used to check each handleChange functions for that header. If the header matches, that onClick function is then called during onChange thus filtering data by that selection.

    Clicking any of the #tags simple sends the data header through an onChange function to the handleHashChange function where the data is checked for a match and all data matching that header is returned.


App functions and Implementations

1. Error Handling

Errors where handled using react useState hook - by updating the initial state with the error message received and rendering it on the screen

Screen Shot 2022-07-11 at 9 42 08 AM

2. Loading State

The loading state was handled with react useState hook. Initially set to false, the loading state is updated to true when the GraphQL API is being called

Screen.Recording.2022-07-12.at.9.13.10.PM.mov

3. Data

using the below query, a limit of 30 was applied to get the needed data, which is used to populate the app

query {
  launchesPast(limit: 30) {
    mission_name
    details
    id
    launch_date_local
    launch_year
    links {
      wikipedia
    }
    launch_site {
      site_name
    }
  }
}

Screen Shot 2022-07-12 at 9 54 05 PM

Extra

  • On search, the length of filtered data is returned

  • On search, the data being filtered is displayed above the id field

  • The Go to Search button quickly take user to the search box

  • App deployed to Netlify

    https://df-clinton-otse.netlify.app/

  • Night/Day mode

  • Mobile responsive

Screen Shot 2022-07-12 at 10 00 26 PM

data-filter's People

Contributors

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