bsdfzzzy / typescript-react-boilerplate

:ghost: Minimal example for React with TypeScript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

typescript-react-boilerplate

Just clone and rename to create your own React app

GitHub License Build Status

Based on

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

Testing

  • jest
  • enzyme

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.

  4. The typescript-eslint is still a very new thing, which means the related configurations may change in the future.

About

:ghost: Minimal example for React with TypeScript.

License:MIT License


Languages

Language:TypeScript 38.0%Language:JavaScript 30.1%Language:CSS 27.3%Language:HTML 4.6%