Hi everyone!
I’m struggling in understanding Frontity libraries. In my case, I want to fetch data about posts from my WP REST API. The default value of per_page is 10 and I want to increase it to 100. So, I use “libraries.source.api.get()” with {endpoint: posts, params: {per_page: 100}}
I read API reference about wp-source libraries and watch videos about wp-source but I don’t understand some points:
Where should I put “libraries.source.api.get()” . In useEffect, or in index.js file?
The doc says: “it doesn’t return data but a promise that is resolved when the action is finished (and state is updated)”. How can I see that update, and how to access to the updated state?
I am trying to imagine how Frontity works, so I’m sorry if these questions is too basic.
Thank you guys so much!
The suggestion of Miracutor also works, but then that will be applied to every single post_type and I believe you don’t want that in probably 90% of the cases.
Oooh yeah and keep in mind per_page: 100 wont work. WP has a limit of 99 per page.
Good luck. Let me know if you have more questions about it.