Created
October 6, 2021 10:51
-
-
Save techomoro/248b6995ef8ec5abaddc803540326e38 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
// 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