Giter Club home page Giter Club logo

react-app-poc's Introduction

POC

This was originally a POC for graphql codegen, but is just becoming a general POC of things.

Scripts

  • npm run [script] -w [server|client]

That's it.

POC topics

  • GraphQL Code generation to Apollo Client React query hooks
    • Formats output to comply with our Eslint rules (not usually recommended to lint generated code)
    • Use of .graphql file format for easier visibility of queries/mutations/fragments
    • Forces file name convention in codegen config for all queries/mutations/fragments to include query/mutation/fragment in the file name
    • Still works behind an auth-protected endpoint, with a custom fetcher to login add the token to the request
    • Far easier to manage and maintain
    • New query? Run the generator and use the hook straight away!
    • 100% accuracy in type safety. For example, in my typeDefs for this very project I defined the books as [Book], and was surprised to see (Book | undefined)[] as a generated type. Then realised that actually, that was totally correct. So I amended the backend typedefs to [Book!] and the generated type was updated accordingly.
    • Works excellently with union types and fragments.
  • ESLint
    • Working with Prettier
    • Working with Tailwind CSS
    • ESLint root config without eslint config package, no need to redefine rules in each project
  • Aliasing in Vite, importing root files without nasty relative paths (../../../../ ๐Ÿคข)
    • It is Vite, but it should be possible with Webpack
    • I would be delighted if we used Vite though. But understand if we don't
  • Zustand for global state management
    • Tests re-render logic to make sure it is efficient
    • Bootstrap hook to update store
    • How to consume the store
    • Glorified reducer, but it's not so coupled the layout of JSX which could make things so much easier
  • MVC pattern in React
    • Zustand as model
    • Parent component as controller
    • View component with simple props from parent component
    • When you define a component, the view component is located in the same file as the wrapping component for easier locality
    • Will greatly help with unit tests, Storybook and Chromatic integration

react-app-poc's People

Contributors

jack3898 avatar jackw-immj avatar

Watchers

 avatar

react-app-poc's Issues

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.