Created
August 13, 2022 05:05
-
-
Save SarahElson/1dd0fdfe46184c775149b2bc974b4f68 to your computer and use it in GitHub Desktop.
How To Style And Write CSS In React
This file contains hidden or 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 React, { Component } from "react"; | |
//react bootstrap components | |
import CardDeck from "react-bootstrap/CardDeck"; | |
import Card from "react-bootstrap/Card"; | |
import Container from "react-bootstrap/Container"; | |
import Row from "react-bootstrap/Row"; | |
//scss | |
import style from "./styles.module.scss"; | |
//data for post | |
import data from "./data.json"; | |
export default class DefaultPost extends Component { | |
render() { | |
return ( | |
<> | |
<Container fluid={true}> | |
<Row> | |
<CardDeck className=' no-gutters '> | |
{data.map((postData) => { | |
console.log(postData); | |
return ( | |
<Card key={postData.id}> | |
<Card.Img variant='top' src={postData.image} /> | |
<Card.Body> | |
<Card.Title className={style.tile}> | |
{postData.title} | |
</Card.Title> | |
<Card.Text className={style.para}> | |
{postData.body} | |
</Card.Text> | |
</Card.Body> | |
</Card> | |
); | |
})} | |
</CardDeck> | |
</Row> | |
</Container> | |
</> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment