我用 connect 明明链接了 store 怎么 这里一直报错,求解
zha
#1
wlt
#2
需要写:
constructor(props) {
super(props);
this.state = {
comments: this.props.comments //这里要用到this.props,必须调用super(props)
}
}
zha
#5
嗯 ,可以不用的,直接传 props就好。 目前又有个问题,我把那个改了之后,又有这个错误: backend.js:92 Uncaught DOMException: Failed to execute ‘postMessage’ on ‘Window’: Symbol(react.element) could not be cloned.
zha
#6
我把那个改了之后,又有这个错误: backend.js:92 Uncaught DOMException: Failed to execute 'postMessage' on 'Window': Symbol(react.element) could not be cloned.
wlt
#14
说了你的map用的有问题,扯什么不能用jsx
this.props.comments.map((comment, index) => {
return (
<p key={index}>{comment}</p>
)
})