Laravel Pagination with ReactJS
Last updated
Last updated
react-laravel-paginex
will provide you ability to easily create pagination from Laravel Pagination object.
npm i react-laravel-paginex
or
yarn add react-laravel-paginex
First import the Pagination component inside your React component.
Then you'll be able to use pagination component.
changePage
prop will run the function ( in our case is getData()
) when new page selected.
data
object must be Laravel default or API Resource Pagination object.
or
You can customize your pagination styles by overwriting default values.
Available props for component:
Prop Name
Default Value
containerClass
pagination
buttonIcons
false
prevButtonClass
page-item
prevButtonText
Prev
prevButtonIcon
fa fa-chevron-left
nextButtonClass
page-item
nextButtonText
Next
nextButtonIcon
fa fa-chevron-right
numberButtonClass
page-item
numberClass
page-link
numbersCountForShow
2
activeClass
active
You can use options
prop by passing options object into it.
You have to define here only props which you want to overwrite.
You can set your own request params for request