项目作者: tkivela

项目描述 :
a project template with React, MobX, Emotion and TypeScript
高级语言: TypeScript
项目地址: git://github.com/tkivela/react-ts-mobx-template.git
创建时间: 2018-05-20T19:30:33Z
项目社区:https://github.com/tkivela/react-ts-mobx-template

开源协议:

下载


react-ts-mobx-app

a template project with React, MobX, Emotion and TypeScript + Unit testing.

Details:

Setup is based on Create-react-app ‘s TypeScript version (react-scripts-ts) but also has some additional features such as decorator syntax (made possible with react-app-rewired).

Prerequisites

You should have Yarn (https://yarnpkg.com/en/) installed. Then run
yarn
in project directory to install package dependencies.

Commands

yarn start

Starts your project and opens it automatically in browser.

yarn test

  • Runs unit tests (with Jest) .

yarn build

Runs yarn test and if it succeeds then builds the app for production to the build folder.

The build is minified and the filenames include the hashes.

Directory structure

  • apis directory contains code for external api interactions.
  • components directory contains reusable components.
  • stores directory contains MobX store definitions.
  • views directory contains views which are routed to different urls.
  1. └── src
  2. ├── apis
  3. ├── components
  4. ├── CustomButton
  5. ├── Note
  6. └── TopNavigation
  7. ├── stores
  8. └── notes
  9. └── views
  10. ├── App
  11. ├── NoteCount
  12. └── Notes

Example project features

The project contains simple application to demonstrate following features:

  • Observables & Observers
  • Actions (both sync & async)
  • Computed state
  • Calling an API with async action and updating results to MobX store
  • Linting & Formatting
  • Testing actions & store with Jest unit tests
  • Testing automatically mocked external api with Jest unit tests
  • Styling components with CSS-in-JS (Emotion)
  • Including devtools in development environment builds (mobx-react-devtools)
  • Including decorator features to CRA based setup (with react-app-rewired)