Check out example codes for "will_paginate gem rails". It will help you in understanding the concepts better.

Code Example 1

## perform a paginated query:
@posts = Post.paginate(page: params[:page])

# or, use an explicit "per page" limit:
Post.paginate(page: params[:page], per_page: 30)

## render page links in the view:
<%= will_paginate @posts %>

Learn ReactJs, React Native from akashmittal.com