Skip to content

Commit

Permalink
Correct react hook
Browse files Browse the repository at this point in the history
  • Loading branch information
Afonso-santos committed Dec 6, 2023
1 parent f6360a5 commit 377d710
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions apps/app/components/LectureForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function LectureForm({ id }) {
const [selectedMentor, setSelectedMentor] = useState({});
const [selectedNinja, setSelectedNinja] = useState({});
const [selectedEvent, setSelectedEvent] = useState({});

const [mentors, setMentors] = useState([]);
useEffect(() => {
listMentors().then((response) => {
Expand Down Expand Up @@ -52,10 +52,11 @@ export default function LectureForm({ id }) {
}, []);

const [ninjas, setNinjas] = useState([]);
const fetchData = useCallback(() => {
let promise;



const fetchData = useCallback(() => {
let promise;

if (!promise) {
promise = Promise.all(events.map((event) => getNinjaEvents(event.id)));
Expand All @@ -74,7 +75,7 @@ export default function LectureForm({ id }) {
)
);
});
}, [fetchData]);
}, [fetchData,events]);

const [filteredNinjas, setFilteredNinjas] = useState([]);
const handleEventChange = useCallback(
Expand Down

0 comments on commit 377d710

Please sign in to comment.