deep-jade13mo ago

How do I use useTable without a resource?

Hi there, I am able to use useTable to retrieve data from a mock api as long as my array of incoming objects is contained within a parent such as { assets: [{},{}...]} but the backend dev just wants to send me a plain array of objects that looks more like [{},{}...]. I tried removing the meta.resource (see attached screenshot). I also tried setting it to a blank string as well as undefined. What is the proper way to do this?
No description
4 Replies
kapa.ai13mo ago
Hi @tirolawz. I'm, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
kapa.ai13mo ago
---------------------- Hmm, I don't know enough to give you a confident answer yet. However, you can refer to the refine documentation for more information on how to use useTable and other related hooks: ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
useTable | refine
By using useTable, you can get properties that are compatible with Ant Design component. All features such as sorting, filtering, and pagination come out of the box. Under the hood it uses useList for the fetch.
kapa.ai13mo ago
<@963837357709222000> is still learning and improving, please let us how it did by reacting below
ratty-blush13mo ago
sorry, I couldn't fully understand the issue. but I want to point some concepts. useTable uses useList under the hood. useList calla dataProvider.getList method. you can customize or create new data provider to manipulate returning data
Data Provider | refine
Data provider acts as a data layer for your app, making HTTP requests and encapsulating how the data is retrieved. The methods of these requests are then consumed by refine via data hooks.