Skip to content

nonoroazoro/typescript-react-boilerplate

Repository files navigation

typescript-react-boilerplate

Just clone and rename to create your own React app

GitHub License

Based on

  • typescript
  • react v18 (with hooks)
  • react-router
  • react-hot-loader
  • css-modules
  • webpack

Testing

  • jest
  • @testing-library

Linter

Something you should know

  1. In transpileOnly mode of ts-loader, the Typescript compiler will not generate declaration files, but you can generate them via tsc.

  2. When using CSS Modules:

    1. You should add a declaration file for e.g. *.less files, for example, less.d.ts.

    2. To make the Iconfont work properly with CSS Modules, you have to import the styles in the global scope:

      :global
      {
          @import "~font-awesome/less/font-awesome.less";
      }
  3. While using react-router, you should use withRouter() as a function call instead of as a decorator (@withRouter), because TypeScript doesn't allow decorators to change the signature of the classes they are decorating.