XeNote/components/MDContainer.js

24 lines
539 B
JavaScript
Raw Normal View History

2023-12-24 06:11:22 +00:00
import React, { useState } from 'react';
import MDContent from "./MDContent";
2023-12-24 06:11:22 +00:00
import { v4 as uuidv4 } from 'uuid';
2023-12-24 06:11:22 +00:00
function MDContainer({ post, fileNames }) {
const [posts, setPosts] = useState([post]);
2023-12-24 06:11:22 +00:00
function handleClick(content) {
setPosts(prevPosts => {
return [...prevPosts, content]
})
}
2023-12-24 06:11:22 +00:00
return (
<div className="">
2023-12-24 06:11:22 +00:00
{posts.map(p => (
<MDContent key={uuidv4()} content={p} handleOpenNewContent={handleClick} fileNames={fileNames} />
))}
</div>
);
}
2023-12-24 06:11:22 +00:00
export default MDContainer;