Comments (4)
@hellowin for this feature I think we need to use immutable on our reducer to minimize the changes on the store. Facebook's Feed API didn't have explicit pagination (we only use cursor pagination) which is need to re-fetch the feed over and over again if we want to get the next page.
Let's say for the first time (select group page) we only fetch the first page
(default is 10 items). If we want to get the second page
, it will re-fetch the feed, request the first page
from pagination cursor and then go to the second page
. With this approach, we will get the same first page
and a brand new second page
.
Please let me know if you have any suggestion. CMIIW
from kanca.
Actually this is very simple approach.
Create React Component which receive list of props props[]
. So it will be like:
<Pagination list={[
{ id: 'x', message: 'x message' },
{ id: 'y', message: 'y message' },
{ id: 'z', message: 'z message' },
]} childComponent={Child} />
On Pagination component it will render something like this:
<pagination elements>
{list.slice(0, 10).map((li, key) => <Child {key, ...props} />)}
</pagination elements>
See .slice(0, 10)
part, that one is handled by Pagination system inside its component using simple state management. For example:
- page 1, with total childs 10, will be
.slice(0, 9)
- page 3, with total childs 10, will be
.slice(30, 49
- etc.
So we can put everything list there and everything component. List of cards, list of tables, etc.
notes:
- Don't use reducer, redux, etc. this one must be isolated and very simple pagination approach which can be used by any components.
- This pagination is for paginating local fetched list, don't use it for fetching etc.
from kanca.
@reyhansofian do you have any progress on this? If not I'll handle this right now.
from kanca.
It's done @reyhansofian, look at this PR #43
from kanca.
Related Issues (20)
- Error in /kanca/welcome
- Error in /kanca/welcome
- Error in /kanca/welcome
- Error in /kanca/group/selection
- Error in /kanca/group/selection
- Error in /kanca/welcome
- Error in /kanca/welcome
- Error in /kanca/welcome
- Error in /kanca/group/selection
- Error in /kanca/group/selection
- Error in /kanca/group/selection
- Error in /kanca/group/selection
- Error in /kanca/welcome
- Error in /kanca/welcome
- Error in /kanca/welcome
- Error in /kanca/group/selection
- Error in /kanca/group/selection
- Error in /kanca/group/selection
- Error in /kanca/group/selection
- Error in /kanca/group/selection
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kanca.