Created
July 23, 2021 03:38
-
-
Save patwadeepak/23b8018175f9b3dc7fda8df5b771ada4 to your computer and use it in GitHub Desktop.
Pure React Way - App.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Posts from "./Components/Posts"; | |
import PostForm from "./Components/PostForm"; | |
import { useState } from "react"; | |
const App = () => { | |
const [PostData, setPostData] = useState([]); | |
const addPost = (formData) => { | |
setPostData([formData, ...PostData]); | |
}; | |
return ( | |
<div className="app-container"> | |
<h1> Pure React Way</h1> | |
<PostForm addPost={addPost} /> | |
<Posts setPostData={setPostData} PostData={PostData} /> | |
</div> | |
); | |
}; | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment