Giter Club home page Giter Club logo

restcount's Introduction

REST Countries API - TypeScript Version

screenshot

This is an app that I rebuilt with TypeScript. You can see the JS version.

An app contains search and dropdown features where users can use a search box to search the desired country and use the dropdown to filter countries by regions (Africa, Americas, Asia, Europe, and Oceania). The users also can click a country to view more detailed information.

The user should be able to:

  • See all countries from the API on the homepage with pagination
  • Search for a country using an input field
  • Filter countries by region
  • Click on a country to see more detailed information on a separate page
  • Click through to the border countries on the detail page
  • Toggle the color scheme between light and dark mode

View the site live here

Tech stack:

TypeScript React React Router Tailwind CSS Vite Testing Library

Screenshots/GIFs

Search Demo


Filter by Region Demo

Filter by region Demo


Theme Switch Demo

Theme Switch Demo


Pagination Demo

Pagination Demo


What I learned

TypeScript

  • Learned about 4 ways to assign types in TypeScript: interface, type, enum, and as.
  • Discovered that as is not a common way to assign types in TypeScript.
  • Encountered a tricky aspect of type checking for the API because the API may have several levels of nested objects.
  • Learned how to use mapped types to assign types to nested objects.
  • Created several TypeScript interfaces to define the structure of data used in the project.
  • Used a TypeScript context to provide and consume data across the project.

useReducer

  • Learned how to use useReducer hook to bundle all state updates into one function with one hook.
  • Recognized that useReducer can be beneficial for larger state updates with multiple actions.

useMemo

  • Learned how to use the useMemo hook to cache the result of a calculation between re-renders.
  • Discovered that useMemo can be used to optimize the performance of an app.

Additionally, I wrote blogs on useReducer and useMemo hooks to improve my understanding of both:

Continued development

I am looking to add React Testing Library for this project to solidify my knowledge of Test-Driven Development.

Resources

restcount's People

Contributors

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