Skip to content

Instantly share code, notes, and snippets.

@techomoro
Created October 6, 2021 10:51
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/248b6995ef8ec5abaddc803540326e38 to your computer and use it in GitHub Desktop.
Save techomoro/248b6995ef8ec5abaddc803540326e38 to your computer and use it in GitHub Desktop.
// components/PostDetails.js
import React from "react";
import { Container, Row, Col } from "react-bootstrap";
import { useSelector } from "react-redux";
import Loader from "react-loader-spinner";
export default function PostDetails() {
const { post, loadingPostDetails } = useSelector(
(state) => state.PostReducer
);
return (
<Container>
{loadingPostDetails ? (
<div className="loader">
<Loader
type="Bars"
color="#00BFFF"
height={50}
width={100}
timeout={3000} //3 secs
/>
</div>
) : (
<Row className="posts">
<Col lg={8} md={10} sm={12}>
<h1>{post.title}</h1>
<div>{post.body}</div>
</Col>
</Row>
)}
</Container>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment