【发布时间】:2017-02-27 11:46:33
【问题描述】:
下面是我的代码
render() {
const mainSection = (
<MainSection
title={ __( 'main.section.title' ) }
onClose={ this.handleOnClose }
/>
);
const secondarySection = (
{
this.state.error ? (
<Message
onClose={ this.handleMessageClose }
style={ styles.message }
>
{ this.state.error }
</Message>
) : null
}
<div>
<SecondaryForm
data={ {
username: this.state.username,
} }
onChangeUsername={ this.handleUsernameChange }
onSaveUsername={ this.handleSaveUserName }
/>
</div>
);
return (
this.state.show.section === true ? { secondarySection } : { mainSection }
);
}
我收到此错误:
必须返回一个有效的 React 元素(或 null)。你可能有 返回未定义、数组或其他一些无效对象。
请帮帮我,谢谢。
【问题讨论】: