An simple skeleton to use hooks, typescript in a reactjs app
- Run
yarn install
- Run
yarn start
- Add package into package.json and use react-app-rewire to initialize project folder
- Set eslint, prettier, typescript, pre-commit hooks to achieve better code style and avoid errors
- Create a home page called
App.tsx
and add page layout - Create routes using
useRoutes()
inApp.tsx
to declare all pages - Create a
useLogin
hook to mock the authentication process - Add unit tests
useLogin
using react-testing-library/hooks - Create a
Login
Page containing two inputs and two buttons- Add loading support
- Show success/error messages
- Add unit tests for
Login
page using react-testing-library
- Add ErrorPage.tsx and Loading.tsx
- Add BasicLayout.tsx to the page
- Login.less: prevent break encapsulation
- Login.tsx: Clear the inputs after login success