skip to Main Content

Reactjs – How to not get error of "to many renders" when I call a function in React?

export default function Weather({destiny}) { const [location, setLocation] = useState('') const [dataExt, setDataExt] = useState({}) const url_ext = `https://api.openweathermap.org/data/2.5/forecast?q=${destiny}&units=metric&appid="here goes appi id"` var list = [] const weatherExt = () => { axios.get(url_ext).then((responseExt) => { setDataExt(responseExt.dataExt) list = responseExt.data.list })…

VIEW QUESTION

ReactJs double render

When I try to refresh page it prints "1" twice. But I'm not using any useState or variable update or state change I think. Can you tell me where I'm wrong? import "./styles.css"; import React, { useState, useEffect, useRef }…

VIEW QUESTION
Back To Top
Search