Reactjs Blaze中componentDidUpdate()的等价物是什么?
您将如何使用生命周期管理功能(即this.state this.props)并将其转换为Blaze中的等效功能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
您会创建自己的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
});
});