GithubHelp home page GithubHelp logo

Comments (2)

github-actions avatar github-actions commented on June 12, 2024

由于缺乏足够的信息,我们暂时关闭了该 Issue。请修改(不要回复) Issue 提供最小重现以重新开启。谢谢。

from umi.

fz6m avatar fz6m commented on June 12, 2024

所有的 model 都是持久化、并且全局的,在整个应用生命周期内都存活,并且在应用启动的时候就会初始化了,它是一个全局的概念,不是局部的 model ,从而这个持久化的 model 可以在任意地方被调用并且分享状态。

如果你需要的局部行为、局部状态,在业务局部用 react context 即可,这样到了这个局部才会调用;或者不要在 model 内使用 useEffect 默认执行的副作用,而是在未来某个时机再去执行对应的初始化操作;或者使用 hox 局部化 model 的库;或者不使用 model 类数据库(因为 model 是上古的数据流方案),现代数据流更推荐使用 jotai / valtio / zustand 管理全局状态,使用 react-query / swr 管理请求状态。

from umi.

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.