JavaScript Pagination in ~10 Minutes (Super EASY!!)

  Рет қаралды 30,219

James Q Quick

James Q Quick

Күн бұрын

Пікірлер: 37
@soniablanche5672
@soniablanche5672 Жыл бұрын
skip/limit is pretty bad if you have a lot of rows. The database is actually iterating through all the items until it reaches the last item to skip. It's better to have some sort of index to use as a reference and fetch only the rows that have an index bigger than the reference index + limit
@marcoio8742
@marcoio8742 Жыл бұрын
Totally agree with you. Especially, nowadays with db that charge per usage like PlanetScale where you are billed per row read and written. Going up with the items, you end up reading a 1000 rows to then return 100 (that's a weird way SQL works honestly). Personally, I am using a method that I read somewhere which is working pretty nicely. You keep the limit to decide the size of the page, and then you receive the last id and when you fetch you use that as a start so you never read more than the number of rows you actually need
@JamesQQuick
@JamesQQuick Жыл бұрын
Great point. It goes beyond the basics as covered in this video, but something worth calling out
@charlesscholton5252
@charlesscholton5252 5 ай бұрын
​@@JamesQQuickI think the introduction of these advanced concepts early on to people will help them understand how important it is. I know I had to learn the hard way from following simple examples that kept me in the dark. It is a very frustrating experience for people to go through.
@melodium10
@melodium10 Жыл бұрын
The perfect explanation doesn't exi- but i thought that pagination is something where there are buttons 1, 2, 3 til the end and u click one of them and go to a page. never thought it was a single page thing too
@JamesQQuick
@JamesQQuick Жыл бұрын
Pagination takes several different forms all with different use cases!
@gioba4912
@gioba4912 Жыл бұрын
With was an awesome in a myriads of ways. - Presentation - clarity - pace - etc! Thank you!
@JamesQQuick
@JamesQQuick Жыл бұрын
WOW! Thank you so much :)
@Joe-SoftwareEngineer
@Joe-SoftwareEngineer Жыл бұрын
For the 1st kind of pagination that you mentioned, why not just pass the page number instead of the skip and calculate the skip server-side?
@JamesQQuick
@JamesQQuick Жыл бұрын
It gives more flexibility to the frontend if the backend accepts both. Different apps may decide to display more/less items at a time. BUT using page number could definitely work!
@CreativeTutorialsWeb
@CreativeTutorialsWeb Жыл бұрын
Always always always love your content James. Great work
@JamesQQuick
@JamesQQuick Жыл бұрын
Thanks so much. really appreciate it :)
@PJlikePajamas
@PJlikePajamas Жыл бұрын
Love it! I’ll be looking forward to learning more about Astro in September!🤘🤘
@JamesQQuick
@JamesQQuick Жыл бұрын
YAYYY!! It's getting close!
@PJlikePajamas
@PJlikePajamas Жыл бұрын
@@JamesQQuick I’ve been reading through the docs today so I’m at least somewhat familiar. Looks awesome, can’t wait to see it in action!
@maxzapom
@maxzapom 2 ай бұрын
This was very interesting thanks
@derekbaker_
@derekbaker_ Жыл бұрын
This was perfect. Thank you
@JamesQQuick
@JamesQQuick Жыл бұрын
So glad you enjoyed it!
@AndreSpecht
@AndreSpecht Жыл бұрын
Amazing. Do you have a tutorial for a blog with React and Firebase (or other DB)?
@gliderguld
@gliderguld Жыл бұрын
How about cursorbased 0:44 pagination? And 'infinitive' data like dates.
@89tain
@89tain Жыл бұрын
This is really nice man
@JamesQQuick
@JamesQQuick Жыл бұрын
So glad you think so@
@simoid6246
@simoid6246 5 ай бұрын
but what if the url not have limit and skip query
@codegenesis2130
@codegenesis2130 7 ай бұрын
what is the vs code theme you are using?? please mention
@rajajunaidf
@rajajunaidf Жыл бұрын
Which VS Code theme are you using?
@JamesQQuick
@JamesQQuick Жыл бұрын
This is my own theme - James Q Quick :)
@rajajunaidf
@rajajunaidf Жыл бұрын
That's Cool 🔥🔥🔥@@JamesQQuick
@defaultname5607
@defaultname5607 5 ай бұрын
c'est pas plus facile getjson => create tab => read 10 first elements ?
@la009895
@la009895 Жыл бұрын
For your Astro course, if you include how to deploy it to prod. Aka the web, I will buy it. I can get projects to run locally but as soon as it’s time to deploy I get lost.
@JamesQQuick
@JamesQQuick Жыл бұрын
Definitely will include publishing to prod!
@HowManyShrimps-g7z
@HowManyShrimps-g7z Жыл бұрын
James, how much money Astro pays for your ad?
@JamesQQuick
@JamesQQuick Жыл бұрын
None at all :) Thanks for clarifying that!
@蹦太君-o4d
@蹦太君-o4d Жыл бұрын
thanks >
@jasonwelsh417
@jasonwelsh417 11 ай бұрын
You can tell this guy has never worked on a production database before
@JamesQQuick
@JamesQQuick 10 ай бұрын
Lol why is that?
@jasonwelsh417
@jasonwelsh417 10 ай бұрын
@@JamesQQuick Your example would have the database iterating until the last row instead of utilizing an index. If you have a large database this is a bad idea.
@charlesscholton5252
@charlesscholton5252 5 ай бұрын
​@@jasonwelsh417 sshhh.. you are revealing too much arcane secret knowledge. I make jokes about how much of these things work great until the database grows or when encountering and dealing with large amounts of data.
Create A Paginated API With Node.js - Complete Tutorial
23:21
Web Dev Simplified
Рет қаралды 196 М.
🍉😋 #shorts
00:24
Денис Кукояка
Рет қаралды 3,7 МЛН
Running With Bigger And Bigger Lunchlys
00:18
MrBeast
Рет қаралды 120 МЛН
5 Tips for Writing BETTER For Loops in JavaScript
16:15
James Q Quick
Рет қаралды 70 М.
UI Libraries Are Dying, Here's Why
13:28
Theo - t3․gg
Рет қаралды 313 М.
JAVASCRIPT: API Pagination
13:17
unblockMe
Рет қаралды 262
Pagination in MySQL - offset vs. cursor
13:20
PlanetScale
Рет қаралды 58 М.
#6 Пишем ПАГИНАЦИЮ на Javascript (PAGINATION JS)
36:39
Как стать программистом
Рет қаралды 23 М.
You don't need a frontend framework
15:45
Andrew Schmelyun
Рет қаралды 127 М.
Tips and Tricks for Debugging JavaScript
13:03
James Q Quick
Рет қаралды 412 М.
CSS Anchor Is The Best New CSS Feature Since Flexbox
15:39
Web Dev Simplified
Рет қаралды 371 М.
Пагинация в React-приложении с Material-UI
26:48
Михаил Непомнящий
Рет қаралды 25 М.
5 Tips For Writing JavaScript FASTER!
11:15
James Q Quick
Рет қаралды 5 М.