-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pagination #3
Comments
Hi @alex-mcleod Please see example by Facebook. // NewsFeed.react.js
class NewsFeed extends React.Component {
render() { ... }
loadMore() {
// read current params
var count = this.props.relay.variables.count;
// update params
this.props.relay.setVariables({
count: count + 5,
});
}
} Also I think it is possible to pass variables to // on page one (for example with articles):
<Button onPress={() => Actions.Comments({id: 123, page: 1})}> // page: 1 not needed if there is additional logic in prepareVariables which manage default value.
See comments
</Button>
// on page two, with comments
Actions.Commend
<Button onPress={() => Actions.refresh({page: 2})}>
Go to page 2
</Button> P.S. Backend from this example doesn't support pagination. So make sure your backend does. |
@r0b1n excellent, thanks for the example. It turned out I need to add a 'viewer' field to my root level query, due to this issue ---> facebook/relay#112. After doing that, I was able to paginate using variables in my react container, rather than using the refresh action to update page state. The problem with refreshing was it would remount the component each time. |
Hello, thanks for providing this. How would I go about paginating data correctly?
The text was updated successfully, but these errors were encountered: