Code Monkey home page Code Monkey logo

reactstatemanage-use's Introduction

ReduxToolkit-use

替代redux的工具ReduxToolkit的基本使用

使用createSlice注意

  1. 首先,Redux 操作类型并不意味着对单个切片是专有的。从概念上讲,每个 slice reducer “拥有”自己的 Redux 状态,但它应该能够监听任何动作类型并适当地更新其状态 例如,许多不同的切片可能希望通过清除数据或重置回初始状态值来响应“用户注销”操作。在设计状态形状和创建切片时请记住这一点。

  2. 其次,如果两个模块尝试相互导入,JS 模块可能会出现“循环引用”问题。这可能导致导入未定义,这可能会破坏需要导入的代码。特别是在“鸭子”或切片的情况下,如果两个不同文件中定义的切片都希望响应另一个文件中定义的操作,则可能会发生这种情况。

当切片A和切片B同时拥有相同类型的action 则会同时触发 可以从引入其他切片的action 栗子

reactstatemanage-use's People

Contributors

hkp4570 avatar

Watchers

 avatar

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.