I wanted to send dictionary data to the frontend
columns_list = [
{"name" : now_day,"value":len(now_list)},
{"name" : previous_day_one , "value" : len(previous_day_one_list)},
{"name" : previous_day_two , "value" : len(previous_day_two_list)}]
return JsonResponse({"data": {
.....
"columns_list" : columns_list,
}}, status=200)
const [column, setColumn] = useState(null);
useEffect(() => {
request
.get("/excel/statistics")
.then((res) => {
let {
data: { data },
} = res;
console.log(data.columns_list);
})
.catch((err) => {
err && console.log(err);
});
});
but,,,infinite loop
i don't know why this code happen infinite loop
so.. just i try console.log
very great
ummmm.... why you don't ???
i did search
useEffect(() => {
request
.get("/excel/statistics")
.then((res) => {
let {
data: { data },
} = res;
....
console.log(data.columns_list);
setColumn(data.columns_list);
})
.catch((err) => {
err && console.log(err);
});
}, []);
Wow :)