Merge branch 'develop' of https://git.it.hs-heilbronn.de/volkmann/smart_garden_server into auribest_dev
This commit is contained in:
commit
b99ca3cefe
@ -18,13 +18,14 @@ export default function Home(props) {
|
||||
const [sensorCardValues, setSensorCardValues] = useState(updateCardValues);
|
||||
const [dataHistory, setDataHistory] = useState(props.dummyData); // for init data
|
||||
|
||||
// runs when the app mounts
|
||||
// runs when the app mounts, similiar to componentDidMount and componentDidUpdate
|
||||
// if you give a prop to useEffect, it also runs each time this prop changes..
|
||||
useEffect(() => {
|
||||
// const data = await fetch('api-address') // fetch data from db here and destructure it
|
||||
console.log("data is changing, start rerender..")
|
||||
setDataHistory(props.dummyData);
|
||||
setSensorCardValues(updateCardValues);
|
||||
}, [props.dummyData])
|
||||
}, [])
|
||||
|
||||
// render the data
|
||||
// make sensorCarddeck responsive
|
||||
|
||||
Loading…
Reference in New Issue
Block a user