Giter VIP home page Giter VIP logo

create-react-app-mobx's Introduction

create-react-app-mobx

use create-react-app for build mobx project.

What did I do?

  1. add mobx in project.
  2. let vscode edit mobx code no waring.
  3. add antd, async/await, scss loader, and my environment.
  4. import outside /src files.

Issue

If you are interested in this project, you can give me feedback in the issue.

如果你有任何疑问,请在 issue 提交给我,我会尽心帮你解答。

How to get decorators in create-react-app

Ok, so here’s what you do when setting up a new React app:

  1. Run create-react-app. This creates a new app with the official configuration.

  2. Run npm run eject. This moves files around and makes your app’s configuration accessible.

  3. Run npm install --saveDev babel-plugin-transform-decorators-legacy. This installs the Babel plugin for decorators. It’s called legacy even though it’s a feature from the far future.

  4. Open package.json, find the "babel" section (line 78 for me), and add 4 lines so it looks like this:

//package.json
"babel": {
  "plugins": [
    "transform-decorators-legacy"
  ],
  "presets": [
    "react-app"
  ]
}
  1. Run npm install --save mobx mobx-react. This installs MobX.

You’re ready to go. Happy hacking! ?

ExperimentalDecorators not recognized in vscode

Steps to Reproduce:

  1. Create Typescript file with decorators (like mobx).

  2. Enable experimentalDecorators in tsconfig.json.

{
  "compilerOptions": {
    "experimentalDecorators": true
  }
}

create-react-app-mobx's People

Contributors

ruoru avatar

Watchers

 avatar  avatar

create-react-app-mobx's Issues

Thinking about using mobx

在 MobX 中可以显式地定义动作,它可以帮你把代码组织的更清晰。 如果是在严格模式下使用 MobX的话,MobX 会强制只有在动作之中才可以修改状态。

mobx document

  • 如果 observable 是 [{},{},{}] 格式类型,改变其中一个选项。并不会渲染。

刚开始使用 MobX 时,人们倾向于频繁的使用 reactions。 黄金法则: 如果你想创建一个基于当前状态的值时,请使用 computed。

  • 内部传值
  • 关闭选项卡几乎会白屏
  • 内部的 ref=dom 不可用
  • 点击一下更新值会比较麻烦

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.