-
Notifications
You must be signed in to change notification settings - Fork 0
/
Agriculture.js
45 lines (41 loc) · 1.2 KB
/
Agriculture.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import React, { useEffect, useState } from 'react'
import { Link } from 'react-router-dom'
import db from './firebase';
import Ao from './home pages/Ao';
function Agriculture() {
const [agric, setagric] = useState([])
useEffect(()=>{
getpns();
},[]);
function getpns(){
db.collection('Agricultural').orderBy('date','desc').limit(3).onSnapshot(function(querySnapshot){
setagric(
querySnapshot.docs.map((doc)=>({
id:doc.id,
title:doc.data().title,
image: doc.data().image,
subtitle:doc.data().Stitle,
desc: doc.data().description,
artlink:doc.data().artlink,
date:doc.data().date
}))
);
});
}
return (
<div className='Polihome1'>
<div className='Poliindex'>
<p>వ్యవసాయం</p>
<Link to={'/వ్యవసాయం'}>More</Link>
</div>
<div className='Polihome'>
{
agric.map(po=>(
<Ao id={po.id} stitle={po.subtitle} title={po.title} image={po.image} desc={po.desc} stamp={po.date} links={po.artlinks}/>
))
}
</div>
</div>
)
}
export default Agriculture