How to implement pagination inside Plasmic Studio in the REST API component?

is it possible to implement pagination inside plasmic studio in the rest api component ?

Keen to know how this could work with loader (not codegen).

Perhaps a pagination code component could fetch the records, paginate and render a page navigation at the bottom that allows you to navigate through the pages with state or something?

I don’t think it can be easily achieved currently, but we are working on improvements for data fetching …

One way, is how Daniel described you could create your own code component that would implement the pagination that you want and use it as a Data Provider for the studio, this way you can manage how the data is going to be displayed and styled in studio

Would you use dynamic pages to implement this as a data provider? Or would that be a slot in a component where you can decide how say, listings of blog posts are displayed?

There is a DataProvider component that allows exactly that https://docs.plasmic.app/learn/data-code-components/#providing-data-with-dataprovider so you would create your component and use the DataProvider in it

Thanks for your guidance Felipe! I’ll look into it.

You should be able to do this as follows:

• Make sure you have a dynamic page
• Define a query parameter such as page
• In your REST API query, specify a dynamic value such as <https://example.com/api/posts?offset=${+$ctx.params.page> * 10}