refresh data when data changes
Closed this issue · 2 comments
Hello,
I use your newest version of your weather widget in a screen. I want that the time and weather refreshes automatically, but do not know how to do it.
I thought something about with setState.
Please, can you help me?
I do not want to refresh the complete website, but only the weather and time data.
So I do not use setInterval()...
@DerNeueGrafiker1 the component will update once the data provided to it changes, since the data is provided using the hooks, these hooks are written so that they refresh the data once the input values changes
useEffect(() => { fetchData(); }, [lon, lat]);
the use effect inside the hooks have the lon, lat params as dependency and so will trigger fetch data if they change
Solution provided, Closed due to inactivity