首页 \ 问答 \ Reactjs生命周期:只在改变状态时调用(Reactjs life cycle: call while only change state)

Reactjs生命周期:只在改变状态时调用(Reactjs life cycle: call while only change state)

在下图中,我们对生命周期方法做出反应。 有没有其他方法只有在我们改变状态时才会调用?

这里的shouldComponentUpdate和comonentWillUpdate都会在更改为props和state的情况下调用。

先谢谢你 !!!

在此处输入图像描述


In below image we have react life cycle methods. Is there any other method which will call only when we change the state only ?

Here shouldComponentUpdate & comonentWillUpdate both will call in case of changes into props and state.

Thank you in Advance !!!

enter image description here


原文:https://stackoverflow.com/questions/39483072
更新时间:2022-03-23 22:03

最满意答案

我建议把这些放到一个单独的类库项目中,然后你可以在你的web项目中引用这个DLL。 然后,您会在Web表单代码的顶部添加一个'using'语句以包含此引用。


And the answer is, obtained from looking into the other answers thanks:

Organise the files into folders within the App_Code folder, they will automatically be included.

相关问答

更多
  • 如果标题本身需要它们,则只能将其包含在标题中。 例子: 您的函数返回类型size_t 。 然后在头文件中#include 。 你的函数使用strlen 。 然后在源文件中#include 。 Only put includes in a header if the header itself needs them. Examples: Your function returns type size_t. Then #include in th ...
  • 您可以将travis为您作为卷执行的PR的克隆/签出装载到docker容器中,然后对其进行操作。 script: - docker run -v ${TRAVIS_BUILD_DIR}:/root/src/ ${IMAGE} /root/src/some_script.sh 你的repo中的some_script.sh运行你喜欢的任何(测试)步骤。 如果您将travis构建配置为也构建PR(通过Web前端),这将自动为PR构建和分支推送做正确的事情。 完整的例子yml You can mount t ...
  • 使用注释的默认c方式是否有效? 是的,使用/* comment */ 。 Does the default c way of using comments work? Yes, use /* comment */.
  • 您应该在头文件中放入#include 并将其从.cpp文件中删除 如下: main.cpp中 #include #include #include #include #include #define _SQLNCLI_ODBC_ #include #include #include "ReadPageAsignations.h" ... 注意 ...
  • 问题是你认为你在使用这个规则,但你没有。 你从来没有定义一个名为all的变量,所以第二个规则的目标实际上扩展到了无 。 当你命令Make来构建myProgram ,Make在这个makefile中找不到合适的规则。 Make有一个隐含规则的工具箱,可以在这种情况下使用; 它想要构建myProgram ,它看到一个名为myProgram.c的文件,其规则如下所示: %: %.c $(CC) $(LDFLAGS) $^ -o $@ 你有它,源之前的链接器标志。 你可以编写自己的模式规则,Make将使用 ...
  • 我建议您迁移到Android Studio并在build.gradle文件中定义配置。 Ok, so I worked a little magic to get things to work. I created the CustomAd class in the core lib. There's also a public static interface in a Util class. The CustomAd runs the methods in the interface, if it is ...
  • 我真的建议不要将jar和dll包含在Git仓库中:它会使仓库回购很快,并且未来的git clone不会像使用简单的源仓库那样容易(比如“没有二进制文件” )。 我会建立一个Nexus repo,并通过sbt来管理你的依赖关系 。 I would really recommend to not include jar and dll in a Git repo: it will make said repo quite big quickly, and the future git clone won't b ...
  • 我建议把这些放到一个单独的类库项目中,然后你可以在你的web项目中引用这个DLL。 然后,您会在Web表单代码的顶部添加一个'using'语句以包含此引用。 And the answer is, obtained from looking into the other answers thanks: Organise the files into folders within the App_Code folder, they will automatically be included.
  • AX7 所有元数据都以XML格式存储在常规文件中并存储在版本控制中。 请参阅此概述 。 AX 2012 AX源(以及属性和编译的p代码和CIL )存储在模型存储数据库中。 在AX 2012 RTM中,模型商店数据库与数据数据库相同(这很愚蠢)。 在AX 2012 R2中,模型商店数据库位于单独的数据库中,通常名称为xxx_Model 。 AX 2009及以下 AX源(连同属性和已编译的P代码)存储在AOS服务器上具有AOD扩展名的二进制文件中。 每个图层都有一个文件。 抱歉,源文件不存在。 XPO文件只是一 ...
  • 以防万一,从工具+选项,项目和解决方案,常规开始,确保勾选“始终显示解决方案”。 在Solution Explorer窗口中,右键单击解决方案(顶部),Properties,Common Properties。 将目录添加到调试源文件。 Just in case, start with Tools + Options, Projects and Solutions, General, ensure "Always show solution" is ticked. In the Solution Explo ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)