当前位置:网站首页>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时,自动调用
边栏推荐
- Eureka-服务注册中心
- 微服务的feign调用header头被丢弃两种解决方案(附源码)
- Ref Hook
- playwright网络爬虫实战案例分享
- Using webmvcconfigurer to intercept interface requests is being enhanced (with source code)
- ros 相机标定 sensor_msgs/CameraInfo Message 数据类型及含义
- Deep analysis - dynamic memory management
- Elastic认证考试:30天必过速通学习指南
- HEAD detached from origin/...导致push失败
- Is the e-commerce billing system important? How should the platform choose billing service providers?
猜你喜欢

Convolution neural network -- convolution of gray image

Use the kubesphere graphical interface dashboard to enable the Devops function

BSN IPFs (interstellar file system) private network introduction, functions, architecture and characteristics, access instructions

JMeter学习笔记004-CSV文件行数控制循环次数

【小样本分割】MSANet: Multi-Similarity and Attention Guidance for Boosting Few-Shot Segmentation

Delete the whole line of Excel, and delete the pictures together

Network knowledge corner | it only takes four steps to teach you to use SecureCRT to connect to ENSP. You must see the operation guide of common tools

Elastic open source community: Developer Recruitment

微服务化解决文库下载业务问题实践

深度剖析 —— 动态内存管理
随机推荐
结构型模式-外观(Facade)模式
Install and configure Debian on a wired network
xxx is not in the sudoers file. This incident will be reported
标准C语言13
Database leader Wang Shan: strive for innovation and carefully Polish high-quality database products
安全第四次课后练习
DINO 论文精度,并解析其模型结构 & DETR 的变体
Elastic开源社区:开发者招募
Preliminary understanding of NiO
sram、dram、sdram、ddr的区别和用途
Network knowledge corner | it only takes four steps to teach you to use SecureCRT to connect to ENSP. You must see the operation guide of common tools
2022-07-26: what is the output of the following go language code? A:5; B:hello; C: Compilation error; D: Running error. package main import ( “fmt“ ) type integer in
利用JSON类型在mysql中实现数组功能
Using webmvcconfigurer to intercept interface requests is being enhanced (with source code)
微服务的feign调用header头被丢弃两种解决方案(附源码)
js修改对象数组的key值
2022-07-26:以下go语言代码输出什么?A:5;B:hello;C:编译错误;D:运行错误。 package main import ( “fmt“ ) type integer in
Delete the whole line of Excel, and delete the pictures together
Influxdb basic understanding
ASP voice notification interface docking demo