Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs Blaze中componentDidUpdate()的等价物是什么?_Reactjs_Meteor_React Jsx_Meteor Blaze - Fatal编程技术网

Reactjs Blaze中componentDidUpdate()的等价物是什么?

Reactjs Blaze中componentDidUpdate()的等价物是什么?,reactjs,meteor,react-jsx,meteor-blaze,Reactjs,Meteor,React Jsx,Meteor Blaze,您将如何使用生命周期管理功能(即this.state this.props)并将其转换为Blaze中的等效功能 您会创建自己的onChange()函数吗?等效的是自动运行 例如,假设您以以下方式使用Blaze模板: {{> Bacon timesSmoked=getTimesSmoked}} 当吸烟次数从1变为2时,您希望它做出响应。您可以对这些更改做出如下反应: Template.Bacon.onCreated(function() { this.autorun(functio

您将如何使用生命周期管理功能(即this.state this.props)并将其转换为Blaze中的等效功能


您会创建自己的onChange()函数吗?

等效的是自动运行

例如,假设您以以下方式使用Blaze模板:

{{> Bacon timesSmoked=getTimesSmoked}}
当吸烟次数从1变为2时,您希望它做出响应。您可以对这些更改做出如下反应:

Template.Bacon.onCreated(function() {
    this.autorun(function() {
        let timesSmoked = Template.currentData().timesSmoked;
        // do something with the new value
    });
});