Archived
fixed infinite query loop
This commit is contained in:
1 parent
78a2308ca6
commit
bc7cbfe11c
1 file changed
+3
-1
@@ -1,4 +1,4 @@
|
|||||||
import { useState } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { Stack } from "react-bootstrap";
|
import { Stack } from "react-bootstrap";
|
||||||
import styles from "./index.module.scss";
|
import styles from "./index.module.scss";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
@@ -7,6 +7,7 @@ import { BACKEND_URL } from "../../constants";
|
|||||||
export const Home = () => {
|
export const Home = () => {
|
||||||
const [events, updateEvents] = useState([]);
|
const [events, updateEvents] = useState([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
axios
|
axios
|
||||||
.get(`${BACKEND_URL}/api/getEvents`)
|
.get(`${BACKEND_URL}/api/getEvents`)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@@ -16,6 +17,7 @@ export const Home = () => {
|
|||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.error(`Failed to fetch events. ${e}`);
|
console.error(`Failed to fetch events. ${e}`);
|
||||||
});
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.con}>
|
<div className={styles.con}>
|
||||||
|
|||||||
Reference in new issue
Block a user