Giter Site home page Giter Site logo

Comments (10)

yisar avatar yisar commented on May 22, 2024 1

我有新的灵感了,我会重开这个仓库,也会支持 watch 和 computed

from asta.

yisar avatar yisar commented on May 22, 2024

不需要这两个属性的…………你说的这两个属性是 mutable 的属性(computed 用于缓存,watch 用于观察变化),vue 和 mbox 需要这两个属性
smox 虽然用了劫持,但是它本质是 immutable,类似于 immer

所以不需要这两个属性的

from asta.

fantasticsoul avatar fantasticsoul commented on May 22, 2024

有这两个属性,一切需求都不再是问题!
需要这两个特性的话,可以看看这个示例:
https://stackblitz.com/edit/cc-computed

from asta.

yisar avatar yisar commented on May 22, 2024

你们先搞清楚watch和computed的作用::>_<::
这两个属性是当数据为可变数据的时候,才是必须的,react生态里,只有mobx这么做
可是smox的处理,虽然用了劫持,但是原数据是不可变的,所以不需要watch和computed

from asta.

fantasticsoul avatar fantasticsoul commented on May 22, 2024

你们先搞清楚watch和computed的作用::>_<::
这两个属性是当数据为可变数据的时候,才是必须的,react生态里,只有mobx这么做
可是smox的处理,虽然用了劫持,但是原数据是不可变的,所以不需要watch和computed

不可变不代表不能够实现或者不需要watch和computed,要不然reselect出来干嘛呢?
可以参见此示例:https://stackblitz.com/edit/cc-computed

from asta.

fantasticsoul avatar fantasticsoul commented on May 22, 2024

watch用于触发一些异步任务
computed用于计算缓存
这些功能本身是vue原来提供的,但是在react里并不是说不需要呀(其实我觉的就算没有,也不妨碍实现业务),对于有此需求的人来说必然是想按照vue思路的组织代码的。

from asta.

yisar avatar yisar commented on May 22, 2024

不可变就是不需要computed和watch的,从本质上不需要,但是如果说非要按vue的思路组织代码,我只能说不推荐的……
smox我弃坑了,对依赖收集和可变数据,可以关注一下新坑 voe,未来我会在里面实现 watch 和 computed
https://github.com/132yse/voe

from asta.

yisar avatar yisar commented on May 22, 2024

reslector 是不可变,但是它确实用了类似响应式的优化思路
但是我觉得引入watch和computed的概念是不合理的,从业务角度来说可能没问题,但是从技术执念方面,我觉得还是坚持一种范式比较好
我不想在不可变的框架和库里面引入这些东西,这只是我个人的认知与立场

from asta.

yisar avatar yisar commented on May 22, 2024

综上所述,smox 我准备弃坑,如果你们想要参与维护的话,我可以开放权限,并帮忙打配合
项目也转移到组织下面?

from asta.

yisar avatar yisar commented on May 22, 2024

搞完了,现在这些都支持了 👍
剩下的都是额外的 feature 了,比如支持 map 和 set 的劫持、支持 watch 和 computed 的参数定制等等,有时间加上

from asta.

Related Issues (20)

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.