Comments (10)
我有新的灵感了,我会重开这个仓库,也会支持 watch 和 computed
from asta.
不需要这两个属性的…………你说的这两个属性是 mutable 的属性(computed 用于缓存,watch 用于观察变化),vue 和 mbox 需要这两个属性
smox 虽然用了劫持,但是它本质是 immutable,类似于 immer
所以不需要这两个属性的
from asta.
有这两个属性,一切需求都不再是问题!
需要这两个特性的话,可以看看这个示例:
https://stackblitz.com/edit/cc-computed
from asta.
你们先搞清楚watch和computed的作用::>_<::
这两个属性是当数据为可变数据的时候,才是必须的,react生态里,只有mobx这么做
可是smox的处理,虽然用了劫持,但是原数据是不可变的,所以不需要watch和computed
from asta.
你们先搞清楚watch和computed的作用::>_<::
这两个属性是当数据为可变数据的时候,才是必须的,react生态里,只有mobx这么做
可是smox的处理,虽然用了劫持,但是原数据是不可变的,所以不需要watch和computed
不可变不代表不能够实现或者不需要watch和computed,要不然reselect出来干嘛呢?
可以参见此示例:https://stackblitz.com/edit/cc-computed
from asta.
watch用于触发一些异步任务
computed用于计算缓存
这些功能本身是vue原来提供的,但是在react里并不是说不需要呀(其实我觉的就算没有,也不妨碍实现业务),对于有此需求的人来说必然是想按照vue思路的组织代码的。
from asta.
不可变就是不需要computed和watch的,从本质上不需要,但是如果说非要按vue的思路组织代码,我只能说不推荐的……
smox我弃坑了,对依赖收集和可变数据,可以关注一下新坑 voe,未来我会在里面实现 watch 和 computed
https://github.com/132yse/voe
from asta.
reslector 是不可变,但是它确实用了类似响应式的优化思路
但是我觉得引入watch和computed的概念是不合理的,从业务角度来说可能没问题,但是从技术执念方面,我觉得还是坚持一种范式比较好
我不想在不可变的框架和库里面引入这些东西,这只是我个人的认知与立场
from asta.
综上所述,smox 我准备弃坑,如果你们想要参与维护的话,我可以开放权限,并帮忙打配合
项目也转移到组织下面?
from asta.
搞完了,现在这些都支持了 👍
剩下的都是额外的 feature 了,比如支持 map 和 set 的劫持、支持 watch 和 computed 的参数定制等等,有时间加上
from asta.
Related Issues (20)
- 可以支持umijs吗? HOT 2
- smox 2.0 重构 HOT 1
- API很漂亮 HOT 3
- 重新思考 smox 的 hooks 支持 HOT 2
- smox,很赞哦 HOT 2
- import { Store, Provider } from 'smox'中Store修改为Smox HOT 2
- *年,你的代码需要有人给 review 下 HOT 4
- new logo and screenshot
- 记录 HOT 1
- 你好有api吗 HOT 1
- 官网增加 Github 的链接 HOT 3
- Rename and new logo
- effect with deps and instead of lifecycles? HOT 2
- 文档地址挂了 HOT 1
- useEffect可使内部返回的cleanup函数在组件卸载时自动执行,用doux如何实现? HOT 5
- 装出来import报TS2307: Cannot find module 'doux' or its corresponding type declarations. HOT 3
- JS.ORG CLEANUP
- can not access doux.js.org
- typo HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asta.