0

I want some advice on what is the best way to handle data , where is i need to table it and on the API there is a pagination endpoint is something like this

"meta": {
        "pagination": {
            "total": 50,
            "count": 10,
            "per_page": 10,
            "current_page": 1,
            "total_pages": 5,
            "links": {
                "next": "http://192.168.1.1/api/sample/users?page=2"
            }
        }
    }

what I did so far is do a for loop until I get all the data from the request but I "worry if my data will turn into hundreds or thousands" then save it to my state and call it in my table I used https://material-table.com to display, the idea I have is to create my own table cause in order to speed up what I think is every click of pagination it will request a certain page to get result rather than give me the whole data , but I worry also on how I will manage the search bar if I can't get the whole data. hope you can give me some tips or idea on how I will work on it or is there any react library that can handle the certain task?

Cœur
  • 37,241
  • 25
  • 195
  • 267
  • If the api supports search functionality, you can disable built-in material-table search, and implement your search box. – SuleymanSah Oct 01 '19 at 06:24
  • you mean i need a functionality also on my backend ? it cant be worked on frontend alone? – hero to zero Oct 02 '19 at 00:19
  • 1
    Yes, there are two options, 1-) server side paging with search functionality. More performant, but requires extra coding. 2-) client side paging with builtin material-table search feature (this will get all the data friom server, less performant, but may not be a problem if the number of records not more than 5000-10000. Needs to be checked. – SuleymanSah Oct 02 '19 at 04:57

0 Answers0