Giter Club home page Giter Club logo

dog's Introduction

Purpose

The idealogy driving how the code is structured in this project is

  • DRY
    • only if you are really really sure the code will be reused, split it
    • or isolate the function / hook when you need to write same logic somewhere else
  • Functional SRP
    • single responsibility as long as it's small and done by product function rather than code function - that is, we split by real world functions such as DogList, DogModal instead of splitting by RenderCode, DataCode, StylesCode.
    • when it gets big, we split it but we want to keep everything in one place if we can
  • co-location principle
    • you keep everything you need in one place, you read it top-down it makes sense without having to go anywhere else
    • types are also kept in the same folder where the components are exposed
    • components are packed into folders when they belong to the same function

The code is structured by function and necessity rather than any rigid formation so it depends on code reviews to keep it clean but I believe it's doable. Each component keeps everything it needs in one place so you can scroll one screen tops and get all the information we need.

Next steps

Following the principles above I'd probably do

  • Take the data fetching into a hook and make it a HOC. Currently it returns "Loading ..." and "Error", I'd want the HOC to handle this.
  • Make sub-breeds-list a separate component if we decide to render the random image for sub-breeds as well.

Requirements

img.png

  • API: https://dog.ceo/dog-api/documentation/
  • Use typescript
  • Use react-query for querying data
  • Use React Bootstrap https://react-bootstrap.netlify.app/ for the modal
  • Not using store
  • Zero Style
  • We add some random data for each Dog Breed (level 1), avgHeight and avgWeightafter loading data. Based on avgHeight and avgWeight, we calculate the POWER index of that breed and show on modal? POWER = avgHeight + avgWeight * 9;

Run the project

  • Install dependencies: yarn
  • Run the project: yarn dev

dog's People

Contributors

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