当前位置:网站首页>redux三大核心
redux三大核心
2022-07-27 03:50:00 【落叶也疯狂】

redux的三个核心概念
1、action
- 动作的对象
- 包含两个属性:type(标识属性)、data(数据属性)、
- 例子:
{ type: 'ADD_STUDENT', data: { name: 'tom', age: 18 } }
2、reducer
- 用于初始化状态、加工状态
- 加工时,根据旧的state和state和action,产生新的state的纯函数
3、store
将state、action、reducer联系在一起的对象
如何得到此对象?
(1)import { createStore } from 'redux'
(2)import reducer from './reducers'
(3)const store = createStore(reducer)此对象的功能?
(1)getState():得到state
(2)dispatch(action):分发action,触发reducer调用,产生新的state
(3)subscribe(listener):注册监听,当产生了新的state时,自动调用
边栏推荐
- Elastic open source community: Developer Recruitment
- Differences and uses of SRAM, DRAM, SDRAM and DDR
- Learning route from junior programmer to architect + complete version of supporting learning resources
- 华为入局商用市场:趋势使然,挑战颇多
- 无有线网络下安装并配置debian
- 电商分账系统重要吗,平台应该如何选择分账服务商呢?
- 结构型模式-外观(Facade)模式
- Remember the major performance problems caused by a TCP packet loss
- Overview of communication protocols
- GenericServlet为什么有两个init方法
猜你喜欢
![Shell中的文本处理工具、cut [选项参数] filename 说明:默认分隔符是制表符、awk [选项参数] ‘/pattern1/{action1}filename 、awk 的内置变量](/img/ed/941276a15d1c4ab67d397fb3286022.png)
Shell中的文本处理工具、cut [选项参数] filename 说明:默认分隔符是制表符、awk [选项参数] ‘/pattern1/{action1}filename 、awk 的内置变量

【比赛参考】PyTorch常用代码段以及操作合集

【day02】数据类型转换、运算符、方法入门

卷积神经网络——24位彩色图像的卷积的详细介绍
![[Code] sword finger offer 04 search in two-dimensional array](/img/7d/a6693bfd24af9d9587539dda458d27.png)
[Code] sword finger offer 04 search in two-dimensional array

Understand kingbasees V9 in one picture

Elastic开源社区:开发者招募

结构型模式-外观(Facade)模式

微信小程序轮播图

Okaleido生态核心权益OKA,尽在聚变Mining模式
随机推荐
深度剖析 —— 动态内存管理
P1438 boring sequence line segment tree + difference
Elastic认证考试:30天必过速通学习指南
Delete the whole line of Excel, and delete the pictures together
Detailed explanation of TCP protocol knowledge
JS modify the key value of the object array
Nacos启动与登录
结构型模式-适配器模式
PX4模块设计之十二:High Resolution Timer设计
Preliminary understanding of NiO
【LeetCode】Day104-无重叠区间
Brightcove appoints Dan Freund as chief revenue Officer
STM32基于HAL库的串口接受中断和空闲中断
Brightcove任命Dan Freund为首席营收官
好用的shell快捷键
Worship the 321 page PDF of the core technology of Internet entrepreneurship that Alibaba is pushing internally. It's really kneeling
Practice of microservice in solving Library Download business problems
Navicat exports Mysql to table structure and field description
ASP语音通知接口对接demo
Head detached from origin/... Causes push failure