0

I have a frontend built in React and a backend built in Express. I query my API from the frontend, and get back 10 results. This is the query in the backend

SELECT * FROM games LIMIT 10

Say I wan to implement infinite scroll. I'd like to query 10 more results, but not the same as before. What technique could I use, both/either on frontend or backend code?

Could I pass perhaps a number to my api string which gets incremented every time, e.g. 1st 10, then 20, then 30, to show the number of results, but how can I do that in a SQL query?

1 Answer 1

1
SELECT * FROM games LIMIT 10 OFFSET 10

Here you will get item 11 to 20. Now you can change the offset value to whatever you want.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.