Skip to content

Commit

Permalink
fix next and back pages
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdlli committed Mar 25, 2022
1 parent 2580968 commit b70adab
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Details from './pages/Details';

import './global.css'

const client = new QueryClient({
export const client = new QueryClient({
defaultOptions: {
queries: {
staleTime: 10000,
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Home/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { Link } from 'react-router-dom'
import { getMovies } from '../../services/apiFilms';
import { useQuery } from 'react-query'
import { Container, MovieList, Movie, Pagination } from './styles';
import { client } from '../..';

function Home() {
const [page, setPage] = useState(1)
const image_path = 'https://image.tmdb.org/t/p/w500/'

const { data, isLoading } = useQuery(["movies"], () => getMovies(page));
const { data, isLoading } = useQuery(["movies", page], () => getMovies(page));
const movies = data?.results
console.log(movies)

function handleChangeBackPage() {
if (page !== 1) {
Expand Down

1 comment on commit b70adab

@vercel
Copy link

@vercel vercel bot commented on b70adab Mar 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.