当前位置:网站首页>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时,自动调用
边栏推荐
- [competition reference] pytorch common code snippet and operation collection
- 好用移动APP自动化测试框架哪里找?收藏这份清单就好了!
- Some common instructions in JVM tuning
- 结构型模式-装饰者模式
- 【小样本分割】MSANet: Multi-Similarity and Attention Guidance for Boosting Few-Shot Segmentation
- Principle of bean validation --07
- Sed output specified line
- shel自动设置目录权限
- STM32 serial port based on Hal library accepts interrupts and idle interrupts
- Prometheus Node Exporter 常用监控指标
猜你喜欢

项目参数做成可配置项,@ConfigurationProperties注解的使用

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

Is the e-commerce billing system important? How should the platform choose billing service providers?

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

influxDB 基础了解

Shel automatically sets directory permissions

Rust:axum learning notes (1) Hello World

【软件工程期末复习】知识点+大题详解(E-R图、数据流图、N-S盒图、状态图、活动图、用例图....)

Anonymous named pipes, understanding and use of interprocess communication in shared memory

The project parameters are made into configurable items, and the @configurationproperties annotation is used
随机推荐
Hash (hash)
数据库泰斗王珊:努力创新,精心打磨优质的数据库产品
ASP语音通知接口对接demo
JMeter learning notes 004-csv file line number control cycle times
There are two solutions for the feign call header of microservices to be discarded (with source code)
P1438 boring sequence line segment tree + difference
Elastic开源社区:开发者招募
微服务化解决文库下载业务问题实践
Effect Hook
Elastic open source community: Developer Recruitment
els_ 画矩形、代码规划和备份
[machine learning network] BP neural network and deep learning-6 deep neural networks (DNN)
playwright网络爬虫实战案例分享
HEAD detached from origin/...导致push失败
可视化领域 SVG
Px4 module design 12: high resolution timer design
Detailed explanation of TCP protocol knowledge
管理信息系统期末复习
Worship the 321 page PDF of the core technology of Internet entrepreneurship that Alibaba is pushing internally. It's really kneeling
结构型模式-外观(Facade)模式