📜  兄弟姐妹之间的唯一键 - 无论代码示例

📅  最后修改于: 2022-03-11 14:56:21.538000             🧑  作者: Mango

代码示例1
function Blog(props) {
  const sidebar = (    
    {props.posts.map((post) =>
  • {post.title}
  • )}
); const content = props.posts.map((post) =>

{post.title}

{post.content}

); return (
{sidebar}
{content}
); } const posts = [ {id: 1, title: 'Hello World', content: 'Welcome to learning React!'}, {id: 2, title: 'Installation', content: 'You can install React from npm.'} ]; ReactDOM.render( , document.getElementById('root') );