Skip to content

Instantly share code, notes, and snippets.

@techomoro
Created October 6, 2021 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techomoro/b7ec9f50bb17d7359f7590b46d00f9f9 to your computer and use it in GitHub Desktop.
Save techomoro/b7ec9f50bb17d7359f7590b46d00f9f9 to your computer and use it in GitHub Desktop.
// 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