iostore
iostore copied to clipboard
极简的全局数据管理方案,基于 React Hooks API
![Uploading WX20211106-153055.png…]()
比如一个语言切换场景 ```js export default createStore({ namespace: 'IntlStore', locale: 'en-gb', m() { // computed 型变量目前实现 return messages[this.locale] }, get m() { // 期望实现, return messages[this.locale] }, setLocale(l) { this.locale = l...
ERROR in ./node_modules/iostore/src/createStore.js Module parse failed: Unexpected token (9:26) You may need an appropriate loader to handle this file type. | | export default config => { | const {...
看了下iostore的实现,很不错,楼主有没有兴趣也试试concent呢 https://github.com/concentjs/concent
nice work dude
因为根据store名称来收集setState,从而触发渲染的 store任何一个属性变化都将触发所有依赖组件渲染,产生不必要的渲染
代码看下,质量蛮高,反正我写不出来。。。那个 addProxy 是一次将对象的深层次,全部代理完。可以参考一下 vue3.0的代理办法,在 get 里面再做代理, 不get就不代理。。。
哈哈,确实很简洁
代码不严谨
export const isObject = o => typeof o === 'object';