Demo site can be found here. This has been a fun project to work on so far.
To clone and run this application, you'll need Git and Node.js (which comes with npm) installed on your computer. From your command line:
# Clone this repository
$ git clone https://github.com/EstherSeyi/paginated-table.git
# Install dependencies
$ npm i
# Run the app
$ npm run start
-
On the browser After running code locally or navigating to the demo site;
- Click on
Next
button to load and view next set of data andPrevious
to go back. - Current page number is displayed beside the
next
andprevious
buttons.
- Click on
-
On the codebase
-
The helpers folder contains the;
-
display-table file which exports the
displayTableData(data, tableRef, init)
function. This function displays and updates the rows of the table based on data provided to it. This functions accepts two compulsory(thedata
andtableRef
) and one optional argument (an boolean which says if the function is being called on initial load or on click of the navigation buttons). -
fetch file which abtracts the fetching operation. It fetches data based on the config detail provided. It also handles fetching activies like error sand loading situations. It takes five arguments the
request url
,onSuccess
,onError
,onLoad
andstopLoad
handlers.
-
-
The types folder contains the types file which returns
User
andData
types. -
The app.ts file contain all the relevant operations including the initial fetch, the next and previous click event handlers.
-
- LinkedIn Esther Ogundijo
- GitHub EstherSeyi