当前位置:网站首页>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时,自动调用
边栏推荐
- The difference between ArrayList and LinkedList
- Brightcove任命Dan Freund为首席营收官
- Wechat input component adds a clear icon, and clicking clear does not take effect
- 深度剖析 —— 动态内存管理
- [machine learning network] BP neural network and deep learning-6 deep neural networks (DNN)
- ROS camera calibration sensor_ Msgs/camerainfo message data type and meaning
- Do you know about wechat merchant billing?
- Rust:axum学习笔记(1) hello world
- 结构型模式-外观(Facade)模式
- 项目参数做成可配置项,@ConfigurationProperties注解的使用
猜你喜欢

F - Pre-order and In-order(Atcoder 255)

Head detached from origin/... Causes push failure

influxDB 基础了解

Shel automatically sets directory permissions

使用WebMvcConfigurer进行接口请求拦截进行中增强(附源码)

Remember the major performance problems caused by a TCP packet loss

第六章:云数据库

安全第四次课后练习

卷积神经网络——24位彩色图像的卷积的详细介绍

华为入局商用市场:趋势使然,挑战颇多
随机推荐
sed输出指定行
安全第四次课后练习
js修改对象数组的key值
Sed output specified line
F - Pre-order and In-order(Atcoder 255)
[small sample segmentation] msanet: multi similarity and attention guidance for boosting few shot segmentation
Plato Farm全新玩法,套利ePLATO稳获超高收益
xxx is not in the sudoers file.This incident will be reported.的解决方法
Ribbon load balancing strategy and configuration, lazy loading and hungry loading of ribbon
第六章:云数据库
RSA 非对称 加密解密 加签验签工具
playwright网络爬虫实战案例分享
php+swoole
shel自动设置目录权限
e.target与e.currentTarget的区别
标准C语言11
Elastic开源社区:开发者招募
微服务化解决文库下载业务问题实践
2022杭电多校联赛第三场 题解
Detailed explanation of TCP protocol knowledge