This article is written as a practical guide to implementing pagination in a Shopify App. The example code assumes a tech stack of React.js and PHP Laravel, but the concepts discussed can be applied to other tech stacks fairly easily.
Pagination is an essential concept in application development for two main reasons.
Shopify’s Metafield REST API is an excellent resource for App and Theme developers, but it comes with a notable limitation — empty strings cannot be saved! This post explores this problem and presents two approaches that can be used to solve it.
Let’s look at an example. Say that you are building a Shopify App that has an optional “Disclaimer” setting that can be used to display a disclaimer to customers.
Merchants using your App can either fill in the disclaimer’s text input or they can simply leave it empty if they prefer not to show a disclaimer.
From the merchant’s perspective, the option could look like…
I’ve read a lot of articles lately that recommend that developers “stop using
for loops” in favor of more specialized looping techniques like
I agree with this recommendation to some extent.
reduce are great tools and I get a lot of value from using them in my own programs.
But on the other hand, there is nothing wrong with simple
for loops. For loops are just as good as
reduce in many situations. And in some other situations, a plain
for loop can be the best option available.
This article will explore four situations where simple