Commit 7ada86cf authored by Thor-Herman's avatar Thor-Herman
Browse files

Add Button for dispatching a new page. Replace ById with AllIdsOrdering #10

parent 259fbe66
import { Card, Content } from 'native-base';
import { Button, Card, Content } from 'native-base';
import React, { useEffect, useState } from 'react';
import { View, Text } from 'react-native';
import { useDispatch, useSelector } from 'react-redux';
import { searchMovies } from '../actions';
import { newPage, searchMovies } from '../actions';
import MovieCard from '../components/MovieCard';
import { RootState } from '../reducers';
import { selectMoviesByAllIdsOrdering } from '../selectors/movieSelector';
const BrowsePage = () => {
const dispatch = useDispatch();
const movies = useSelector((state: RootState) => state.movies.byId);
const movies = useSelector(selectMoviesByAllIdsOrdering);
const movieElements = Object.values(movies).map((movie) => ( // List of all the movies that returned from the search
<MovieCard
id={movie.id}
......@@ -34,6 +34,7 @@ const BrowsePage = () => {
return (
<Content>
{determineRender()}
<Button onPress={() => {dispatch(newPage(2, 10))}}><Text>Load more...</Text></Button>
</Content>
);
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment