📅  最后修改于: 2022-03-11 14:56:21.538000             🧑  作者: Mango
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')
);