当前位置:网站首页>Getderivedstatefromprops lifecycle
Getderivedstatefromprops lifecycle
2022-07-28 13:13:00 【Pig Xiaoyong】
The function of this life cycle is actually the incoming props Mapping to state above .
getDerivedStateFromProps It's a static function , That is, this function cannot pass this Access to the class Properties of , Direct access to properties is not recommended . It should be provided through parameters nextProps as well as prevState To judge , According to the new incoming props To map to state.
The function must have a return value . When props Incoming content does not need to affect state, You must return one null
static getDerivedStateFromProps(nextProps, prevState) {
if (nextProps.id !== prevState.id) {
return {
editData: nextProps.editData,
id: nextProps.id,
targetKeys: nextProps.editData?.details?.map(item => item.companyId)
}
}
return null
}
边栏推荐
- How to improve deep learning performance?
- Summary: idea problem record
- [Bi design teaching] STM32 and FreeRTOS realize low power consumption
- QT signal and slot mechanism (detailed)
- Leetcode94. Middle order traversal of binary trees
- Fundamentals of machine learning Bayesian analysis-14
- [FPGA] FIR filter - half band filter
- [matlab]: FFT related problems
- [error prone points of C language] Part 4: detailed rules for storing structures in memory
- Use and source code of livedata in jetpack family bucket
猜你喜欢

Black cat takes you to learn EMMC Protocol Part 24: detailed explanation of EMMC bus test program (cmd19 & cmd14)

SSH port forwarding (Tunneling Technology)

2020-12-07

Code layered management of interface testing based on RF framework
![[graduation design] oscilloscope design and Implementation Based on STM32 - single chip microcomputer Internet of things](/img/c7/87027ded6d9e522952827fae0fccbd.png)
[graduation design] oscilloscope design and Implementation Based on STM32 - single chip microcomputer Internet of things

Problem solving during copilot trial

04 pyechars geographic chart (example code + effect diagram)

机器学习实战-集成学习-23

Fundamentals of machine learning - principal component analysis pca-16

How can non-standard automation equipment enterprises do well in product quality management with the help of ERP system?
随机推荐
[matlab] IIR filter
面试必问,敲重点!讲一下 Android Application 启动流程及其源码?
黑猫带你学eMMC协议第27篇:什么是eMMC的动态容量(Dynamic Capacity)?
Dimming and color matching cool light touch chip-dlt8ma12ts-jericho
Remove the plug-in of category in WordPress link
Installation and reinstallation of win11 system graphic version tutorial
机器学习基础-支持向量机 SVM-17
Why neural networks are ineffective?
机器学习基础-集成学习-13
What is C generic, generic cache, generic constraint
【嵌入式C基础】第7篇:C语言流程控制详讲
LeetCode每日一题(2196. Create Binary Tree From Descriptions)
Databinding+livedata can easily realize skin changing without restart
QT signal and slot mechanism (detailed)
Chinese translation of pointnet:deep learning on point sets for 3D classification and segmentation
机器学习实战-逻辑回归-19
Transaction of MySQL underlying principle (2)
SSM框架网上书城全套
Vs code is not in its original position after being updated
Zurich Federal Institute of technology | reference based image super resolution with deformable attention transformer (eccv2022))