Skip to content

Commit

Permalink
fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
ludmilka-k committed Nov 7, 2023
1 parent 0d7d0d1 commit 3b5e2d6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pages/Catalog/Catalog.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useState } from 'react';
import { useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import {fetchCarsThunk} from '../../redux/operations';
import FilterBar from '../../components/FilterBar';
Expand All @@ -12,15 +12,15 @@ const Catalog = () => {
const showLoadMore = useSelector(selectShowLoadMore);
const page = useSelector(selectPage);

var currentPage = 0;
let currentPage = 0;

useEffect(() => {
console.log("(fetchCarsThunk: " + page);
if (page > currentPage) {
dispatch(fetchCarsThunk(page));
currentPage = page;
}
}, [page]);
}, [page, dispatch]);

return (
<>
Expand Down

0 comments on commit 3b5e2d6

Please sign in to comment.