XeNote/components/MDContainer.js
Tuan Cao 36dcfbb2bc Wrapping MD Content inside MD Container
Boiler plate code for adding multiple MD Content
2022-03-31 16:59:10 +07:00

24 lines
588 B
JavaScript

import React, {useState} from 'react';
import MDContent from "./MDContent";
import {v4 as uuidv4} from 'uuid';
function MDContainer({post}) {
const [posts, setPosts] = useState([post]);
function handleClick(content) {
console.log(content)
setPosts(prevPosts => {
return [...prevPosts, content]
})
}
return (
<div className="Container">
{posts.map(p => (
<MDContent key={uuidv4()} content={p} handleOpenNewContent={handleClick}/>
))}
</div>
);
}
export default MDContainer;