Comments (4)
看起来是预期行为的
from hox.
有点不解,加了一层model之后会致使model的Effect延后这样设计的原因是什么。
因为如果我的model的初始化执行放在useEffect中的话,这时使用model的page需要使用其暴露出来的方法(需要model初始化才能正常执行)
在这种延后情况下,就必须在增加一个ready State的判断处理。
还是说我demo中的model引入顺序有问题才导致这样的?
@awmleer
from hox.
抱歉回复的有些迟了,你发的 codesandbox 我今天看了一下,的确会有你说的这个 useEffect 顺序的问题,但是我确认了一下,这个是预期行为
model 和组件树之间的 useEffect 顺序是没有办法保证谁先谁后的,这是由于 v1 的 hox 的渲染机制导致的,v1 的 hox 是会把 model 独立渲染到另一个 React app 中,和你应用的组件树是完全独立的,如果你需要严格的确保 useEffect 顺序,可以考虑尝试一下 hox v2(目前还在 alpha 中)
from hox.
from hox.
Related Issues (20)
- 支持Taro吗 HOT 2
- 报错 HOT 1
- 使用Hox的Provider之后,tab切换失效了 HOT 1
- 在next中使用时会报服务端渲染错误,Missing getServerSnapshot, which is required for server-rendered content. Will revert to client rendering. HOT 2
- 请问在umijs中如何使用hox? HOT 2
- 支持react native HOT 2
- 对象解构使用剩余参数会报错 HOT 5
- how-to-migrate-from-v1-to-v2 HotRoot is a spelling mistake HOT 1
- 很久没更新了,问题量也不多,还在维护吗 HOT 3
- 强烈建议增加销毁方法
- 父子组件消费 model,子组件 useEffect 内使用改动 model 父组件无法同步问题 HOT 6
- API 中是否可以提供 forwardRef 的支持 HOT 1
- peerDependencies中React版本声明问题
- 使用生产环境cdn react.production.min.js,会导致死循环 HOT 2
- createStore -> createModel HOT 2
- yarn install fails in github actions but it's ok in my local machine HOT 1
- 在Provider外部设置children的属性,children不更新 HOT 6
- 非global store互相引用时,报undefined错误 HOT 5
- 从 v1 升级, 示例代码 HoxRoot 弄成了 HotRoot
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 hox.