reactJS fetch json data from API

I am the new guy in the JS and reactJS.
I want to get info from API to an array. I made API that show all the info from my DB.
It looks like this :
press here

const [tempNew, setTempNew] = useState([]);
const getAllWeatherCelsius = () => {
      .then(response => {
        return response.json();
      .then((jsonData) => {
        let tmpArray = [];
        for (var i = 0; i < jsonData.length; i++) {
          tmpArray.push(jsonData.dayCelsius[i])   <---- here is the error

Im want to collect all values from "dayCelsius" line into array.
What i need to change in this code ? Thank you 🙂

52 thoughts on “reactJS fetch json data from API”

Leave a Comment