Answer the question
In order to leave comments, you need to log in
How to update an array picked by a selector from Redux so that the component is not completely re-rendered?
Good afternoon. I ran into a problem when adding new elements to the array, which is used to create components and render them on the page.
I fetch an array with elements from the server (there are 40 objects in it), then I import it into a component and use it to render child components.
{
loading ? <Spinner /> : trendingGames.map(game => <GamePreviewItem game={game} key={game.id} />)
}
case TrendingActionTypes.FETCH_TRENDING_SUCCESS:
return {
...state,
trendingGames: action.payload,
loading: false,
error: null
}
case TrendingActionTypes.FETCH_MORE_TRENDING_SUCCESS:
return {
...state,
trendingGames: [...state.trendingGames, ...action.payload],
loading: false,
error: null
}
Answer the question
In order to leave comments, you need to log in
Look towards react-infinite-scroll.
https://www.npmjs.com/package/react-infinite-scroll...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question