diff --git a/examples/pagination-controlled/src/App.js b/examples/pagination-controlled/src/App.js
index 4f90513..eaf5a5b 100644
--- a/examples/pagination-controlled/src/App.js
+++ b/examples/pagination-controlled/src/App.js
@@ -1,8 +1,8 @@
-import React from 'react'
-import styled from 'styled-components'
-import { useTable, usePagination } from 'react-table'
+import React from "react";
+import styled from "styled-components";
+import { useTable, usePagination } from "react-table";
-import makeData from './makeData'
+import makeData from "./makeData";
const Styles = styled.div`
padding: 1rem;
@@ -35,7 +35,7 @@ const Styles = styled.div`
.pagination {
padding: 0.5rem;
}
-`
+`;
// Let's add a fetchData method to our Table component that will be used to fetch
// new data when pagination state changes
@@ -45,7 +45,7 @@ function Table({
data,
fetchData,
loading,
- pageCount: controlledPageCount,
+ pageCount: controlledPageCount
}) {
const {
getTableProps,
@@ -61,28 +61,30 @@ function Table({
nextPage,
previousPage,
setPageSize,
+ rows,
// Get the state from the instance
- state: { pageIndex, pageSize },
+ state: { pageIndex, pageSize }
} = useTable(
{
columns,
data,
- state: { pageIndex: 0 }, // Pass our hoisted table state
+ initialState: { pageIndex: 0 }, // Pass our hoisted table state
manualPagination: true, // Tell the usePagination
// hook that we'll handle our own data fetching
// This means we'll also have to provide our own
// pageCount.
- pageCount: controlledPageCount,
+ pageCount: controlledPageCount
},
usePagination
- )
+ );
// Now we can get our table state from the hoisted table state tuple
// Listen for changes in pagination and use the state to fetch our new data
React.useEffect(() => {
- fetchData({ pageIndex, pageSize })
- }, [fetchData, pageIndex, pageSize])
+ console.log(pageIndex);
+ fetchData({ pageIndex, pageSize });
+ }, [fetchData, pageIndex, pageSize]);
// Render the UI for your table
return (
@@ -95,7 +97,7 @@ function Table({
pageSize,
pageCount,
canNextPage,
- canPreviousPage,
+ canPreviousPage
},
null,
2
@@ -107,7 +109,7 @@ function Table({
{headerGroups.map(headerGroup => (
{headerGroup.headers.map(column => (
-
{column.render('Header')}
+
{column.render("Header")}
))}
))}
@@ -119,18 +121,23 @@ function Table({
{row.cells.map(cell => {
return (
-
{cell.render('Cell')}
- )
+
{cell.render("Cell")}
+ );
})}
)
)}
- {loading ? (
- // Use our custom loading state to show a loading indicator
-
+
+ {loading ? (
+ // Use our custom loading state to show a loading indicator