[英]entity is not rendering react.js
I have a react.js application with changed status. 我有一个状态已更改的react.js应用程序。 I want to display to user some data using
Entity
. 我想使用
Entity
向用户显示一些数据。 The problem is, in the first time being rendered it's ok, but the component do not response to the changes behind. 问题是,在第一次渲染时就可以了,但是组件无法响应后面的更改。 This works fine:
这工作正常:
getPaymentData() {
let data = "";
switch (this.props.params.type) {
case "success":
if (this.state.validate)
data = 'The_payment_was_received' ;
else
data = 'Checking' ;
break;
case "error":
data='There_was_an_error';
break;
case "cancel":
data='The_payment_was_canceled' ;
break;
}
return data
}
and in the render method: 并在render方法中:
<h2 style={{marginBottem :"10px"}}> { ::this.getPaymentData()} </h2>
but - when I do this, it is not responding. 但是-当我这样做时,它没有响应。
case "cancel":
data='The_payment_was_canceled';
break;
}
return <Entity entity= data>
or 要么
<h2 style={{marginBottem :"10px"}}> <Entity entity={ ::this.getPaymentData()} /> </h2>
Why? 为什么?
<Entity entity= data>
is incorrect. <Entity entity= data>
不正确。 Use 采用
<Entity entity={ ::this.getPaymentData()} />
seems incorrect to me. <Entity entity={ ::this.getPaymentData()} />
在我看来不正确。 Why ::
is for? 为什么
::
用于? Use 采用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.