Giter VIP home page Giter VIP logo

Comments (4)

awmleer avatar awmleer commented on June 3, 2024

看起来是预期行为的

from hox.

comewithl avatar comewithl commented on June 3, 2024

有点不解,加了一层model之后会致使model的Effect延后这样设计的原因是什么。

因为如果我的model的初始化执行放在useEffect中的话,这时使用model的page需要使用其暴露出来的方法(需要model初始化才能正常执行)
在这种延后情况下,就必须在增加一个ready State的判断处理。

还是说我demo中的model引入顺序有问题才导致这样的?
@awmleer

from hox.

awmleer avatar awmleer commented on June 3, 2024

抱歉回复的有些迟了,你发的 codesandbox 我今天看了一下,的确会有你说的这个 useEffect 顺序的问题,但是我确认了一下,这个是预期行为

model 和组件树之间的 useEffect 顺序是没有办法保证谁先谁后的,这是由于 v1 的 hox 的渲染机制导致的,v1 的 hox 是会把 model 独立渲染到另一个 React app 中,和你应用的组件树是完全独立的,如果你需要严格的确保 useEffect 顺序,可以考虑尝试一下 hox v2(目前还在 alpha 中)

from hox.

comewithl avatar comewithl commented on June 3, 2024

from hox.

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.