GithubHelp home page GithubHelp logo

febeck / react-chat-application-demo Goto Github PK

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

Created with StackBlitz ⚡️

Home Page: https://stackblitz.com/edit/github-hdjohr

JavaScript 6.66% TypeScript 93.34%

react-chat-application-demo's Introduction

Chat application demo

Edit on StackBlitz ⚡️

Technologies

  • Next.js
  • Chakra UI -> Component library with good components, theme and accessibility
  • React Query -> Library responsible for handling loading and error states when communication with an autocompletion
  • React Testing library -> Write good test, which simulate the real behaviour of the user instead of implementation details
  • StackBlitz -> good in the browser technology to have instant feedback

Design decisions

  • In a real world chat the request would come from the network and posted back for creating a new. I mimicked this behaviour by using promises to return results of elements in a static list
  • I used React Query, instead of Redux because this is the solution I would use to handle this sceario instead of Redux as suggested in the exercise. After a long time using of Redux, it creates indirection in the way of handling data and you're required to "reinvent the wheel" many times. In addition to that, react-query is capable of managing the browser cache for us in an efficient way
  • Intead of simpling adding a new comment to the list after a submit I tried and emulate a real world scenario with optimistic update. This can be seen by the fact that the new comment is intantly added to the list (and the user sees the spinner), which is removed after the sucessful "request" made to this fake API.
  • On the addition of the new element, the comments list automatically scrolls to the bottom allowing the user to see the newly added comments

Scripts

  • npm run dev: Starts the dev server and allows for instant code updates
  • npm run types: Runs the TypeScript type checker
  • npm run test: Runs ths single test validating the flow to add a new comment to the list (with transitional loading state)

react-chat-application-demo's People

Contributors

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