This is my react project template set up with create react app
and its redux-typescript
template; added with eslint
& prettier
for linting and formating, jest dom
and jest axe
for testing, styled-components
for styling, storybook
with its various add-ons for component developing.
This react redux template adopts ducks
pattern, see ref: https://github.com/erikras/ducks-modular-redux. Also, style guide coming from redux starter kit should be followed, see ref: https://redux-toolkit.js.org/
The folders are structured as below:
├── .storybook
└── src
├── components
│ └── my-component
│ ├── my-component.stories.tsx
│ ├── my-component.test.tsx
│ ├── my-component.styles.tsx
│ ├── index.tsx (where the component lives)
│ └── utils
│ ├── helpers.ts
│ └── helpers.test.ts
├── containers
│ └── feature-a
│ ├── components
│ │ └── feature-a-component.tsx
│ ├── feature-a.styles.tsx
│ └── index.tsx
├── stores
│ ├── store.ts
│ └── feature-a
│ ├── slice.ts
│ ├── thunks.ts
│ ├── selector.ts
│ ├── constants.ts
│ ├── types.ts
│ ├── feature-a.test.ts (test all store item: reducers, selectors, actions etc)
│ └── api.ts
├── styled-components
│ ├── theme.ts
│ ├── global-styles.ts
│ └── styled.d.ts (override styled component type)
├── types (global types)
└── utils (pure functions as global helpers)
Note that the project is set up with husky
and lint-staged
do every commit needs to pass linting and formatting rules.
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.
Builds the storybook for all the stories, can be used to develop components in isolation.
Useful for deploying storybook individually.
Manually fix formatting issues for all files. Incuded in the lint-staged setting.
Manually lint for all files. Included in the lint-staged setting.