File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change
1
+ const Card = ( { title } ) => {
2
+ return (
3
+ < div className = "card mb-3" >
4
+ < div className = "card-body" >
5
+ { title }
6
+ </ div >
7
+ </ div >
8
+ ) ;
9
+ } ;
10
+
11
+ export default Card ;
Original file line number Diff line number Diff line change 1
1
import axios from 'axios' ;
2
2
import { useState , useEffect } from 'react' ;
3
+ import Card from '../components/Card' ;
3
4
4
5
const ListPage = ( ) => {
5
6
const [ posts , setPosts ] = useState ( [ ] ) ;
@@ -19,7 +20,12 @@ const ListPage = () => {
19
20
< h1 > Blogs</ h1 >
20
21
{ posts . map ( post => {
21
22
return (
22
- < div key = { post . id } > { post . title } </ div >
23
+ < Card key = { post . id } title = { post . title } />
24
+ // <div class="card mb-3" key={post.id}>
25
+ // <div class="card-body">
26
+ // {post.title}
27
+ // </div>
28
+ // </div>
23
29
) ;
24
30
} ) }
25
31
</ div >
You can’t perform that action at this time.
0 commit comments