Reactjs 反应嵌套组件呈现问题
这是我的密码Reactjs 反应嵌套组件呈现问题,reactjs,Reactjs,这是我的密码 const Parent = (props) => <div> {props.children} </div> it works: <Parent> <a href="/google">Click here </a> </Parent> This doesn't work <Parent> <Abutton /> </Parent> const Abu
const Parent = (props) => <div> {props.children} </div>
it works:
<Parent> <a href="/google">Click here </a> </Parent>
This doesn't work
<Parent> <Abutton /> </Parent>
const Abutton = (props) => <a href="/google">Click here </a>
而不是
来关闭标记const Parent=(props)=>{props.children}
ReactDOM.render(
,
文件正文
);代码>
您缺少一个/
用于编辑语法的
您的代码中有一个拼写错误Abutton
缺少自动关闭标签的/
。
Uncaught Invariant Violation: Element type is invalid: expected a string (for built-in components)
const Parent = (props) => <div> {props.children} </div>