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 styles from "./index.module.scss";
|
||||
import axios from "axios";
|
||||
@@ -7,6 +7,7 @@ import { BACKEND_URL } from "../../constants";
|
||||
export const Home = () => {
|
||||
const [events, updateEvents] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
axios
|
||||
.get(`${BACKEND_URL}/api/getEvents`)
|
||||
.then((res) => {
|
||||
@@ -16,6 +17,7 @@ export const Home = () => {
|
||||
.catch((e) => {
|
||||
console.error(`Failed to fetch events. ${e}`);
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className={styles.con}>
|
||||
|
||||
Reference in new issue
Block a user