XeNote/components/MDContainer.js

24 lines
624 B
JavaScript
Raw Normal View History

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