Created
October 6, 2021 10:41
-
-
Save techomoro/b7ec9f50bb17d7359f7590b46d00f9f9 to your computer and use it in GitHub Desktop.
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
// pages/SinglePost.js | |
import { useEffect } from "react"; | |
import { Container } from "react-bootstrap"; | |
import PostDetails from "../components/PostDetails"; | |
import { useDispatch } from "react-redux"; | |
import { getPostDetails } from "../store/posts/actions"; | |
import { useParams } from "react-router-dom"; | |
function SinglePost() { | |
let params = useParams(); | |
let dispatch = useDispatch(); | |
useEffect(() => { | |
dispatch(getPostDetails(params.id)); | |
}, [params.id]); | |
return ( | |
<Container className="single-post"> | |
<PostDetails /> | |
</Container> | |
); | |
} | |
export default SinglePost; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment