yu-tou / S Mobx
轻量级mobx实现,仅供参考
Stars: ✭ 116
Programming Languages
javascript
184084 projects - #8 most used programming language
Projects that are alternatives of or similar to S Mobx
Muse
🎧 All you need is a simple and diligent HTML 5 music player written in React.
Stars: ✭ 82 (-29.31%)
Mutual labels: mobx
Jspm React
lightweight React.js ES6 boilerplate with JSPM and proper hot reloading modules
Stars: ✭ 104 (-10.34%)
Mutual labels: mobx
React Mobx Firebase Authentication
🔥Boilerplate Project for Authentication with Firebase in React and MobX
Stars: ✭ 111 (-4.31%)
Mutual labels: mobx
React Native Template Mobx
A react-native template using advanced mobx Architecture
Stars: ✭ 99 (-14.66%)
Mutual labels: mobx
Mobxapp
Basic MobX app with FlatList, StyledComponents, Flow, react-navigation.
Stars: ✭ 107 (-7.76%)
Mutual labels: mobx
Compare React State Management
React createContext vs Apollo vs MobX vs Redux in a simple todo app.
Stars: ✭ 81 (-30.17%)
Mutual labels: mobx
Koa Mobx React Starter
A straightforward starter for Node javascript web projects. Using Koa, MobX and ReactJS (with universal / isomorphic server rendering)
Stars: ✭ 102 (-12.07%)
Mutual labels: mobx
Datx
DatX is an opinionated JS/TS data store. It features support for simple property definition, references to other models and first-class TypeScript support.
Stars: ✭ 111 (-4.31%)
Mutual labels: mobx
Next Starter
Next.js Starter using GraphQL, MobX (Next.js, TypeScript, Babel, Express.js, Apollo Client, React Apollo, React Apollo Hooks, GraphQL Codegen, MobX, mobx-state-tree, styled-components, next-optimized-images, Serverless Framework, AWS Lambda, Dotenv)
Stars: ✭ 90 (-22.41%)
Mutual labels: mobx
Babel Plugin Mobx Deep Action
Reduces `action` and `runInAction` boilerplates
Stars: ✭ 110 (-5.17%)
Mutual labels: mobx
Starhackit
StarHackIt: React/Native/Node fullstack starter kit with authentication and authorisation, data backed by SQL, the infrastructure deployed with GruCloud
Stars: ✭ 1,253 (+980.17%)
Mutual labels: mobx
Bankflix
Aplicação que simula um banco digital, contendo a área do cliente e administrativa, permitindo depósitos e transferências entre contas do mesmo banco. | Application that simulates a digital bank, containing the customer and administrative areas, allowing deposits and transfers between accounts of the same bank.
Stars: ✭ 82 (-29.31%)
Mutual labels: mobx
Clean State
🐻 A pure and compact state manager, using React-hooks native implementation, automatically connect the module organization architecture. 🍋
Stars: ✭ 107 (-7.76%)
Mutual labels: mobx
Feline For Product Hunt
A beautiful, unofficial app for Product Hunt
Stars: ✭ 115 (-0.86%)
Mutual labels: mobx
原理解析
使用
npm install s-mobx --save
优势
- 兼容常用的mobx语法
- 打包后 6K,GZip后 2.3K(mobx+mobx-react:71K,GZip 20.9K)
目前兼容的mobx用法:
- @observable
- @observer
- @computed
- extendObservable
- createObservable
- autorun
前提
babel需要配置以下插件才可使用。(.babelrc,react-native项目默认包含此配置)
"plugins": [
"transform-decorators-legacy",
"transform-class-properties"
]
项目需依赖(package.json):
"babel-plugin-transform-decorators-legacy": "*",
"babel-plugin-transform-class-properties": "*", // rn 不需要
"babel-preset-es2015": "*" // rn 不需要
标注 observable 以及 autorun 的用法
import {
observable,
autorun,
computed
} from 's-mobx';
class Person {
@observable
name = {
key:{
key:1
}
};
@computed get age() {
return this.name.key.key;
}
}
const person = new Person();
autorun(function(){
console.log(person.age);
})
person.name.key.key = 3;
person.name.key.key = 4;
给React组件设置 observer
import {
observer,
} from 's-mobx';
import React, {Component} from 'react';
import SettingStore from './../../stores/setting';
@observer
class Index extends Component {
constructor() {
this.store = new SettingStore();
}
render() {
return (
<IndexView store={this.store} />
);
}
}
export default Index;
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].