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

Поділитися
Вставка
  • Опубліковано 8 лис 2024

КОМЕНТАРІ • 37

  • @soniablanche5672
    @soniablanche5672 Рік тому +8

    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 Рік тому +1

      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  Рік тому +2

      Great point. It goes beyond the basics as covered in this video, but something worth calling out

    • @charlesscholton5252
      @charlesscholton5252 6 місяців тому

      ​@@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 Рік тому +3

    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  Рік тому +2

      Pagination takes several different forms all with different use cases!

  • @gioba4912
    @gioba4912 Рік тому +1

    With was an awesome in a myriads of ways.
    - Presentation
    - clarity
    - pace
    - etc!
    Thank you!

  • @PJlikePajamas
    @PJlikePajamas Рік тому

    Love it! I’ll be looking forward to learning more about Astro in September!🤘🤘

  • @Joe-SoftwareEngineer
    @Joe-SoftwareEngineer Рік тому +6

    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  Рік тому +1

      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 :)

  • @maxzapom
    @maxzapom 4 місяці тому

    This was very interesting thanks

  • @derekbaker_
    @derekbaker_ Рік тому +1

    This was perfect. Thank you

  • @89tain
    @89tain Рік тому

    This is really nice man

  • @AndreSpecht
    @AndreSpecht Рік тому

    Amazing. Do you have a tutorial for a blog with React and Firebase (or other DB)?

  • @codegenesis2130
    @codegenesis2130 8 місяців тому

    what is the vs code theme you are using?? please mention

  • @rajajunaidf
    @rajajunaidf Рік тому +1

    Which VS Code theme are you using?

    • @JamesQQuick
      @JamesQQuick  Рік тому +1

      This is my own theme - James Q Quick :)

    • @rajajunaidf
      @rajajunaidf Рік тому

      That's Cool 🔥🔥🔥@@JamesQQuick

  • @gliderguld
    @gliderguld Рік тому

    How about cursorbased 0:44 pagination? And 'infinitive' data like dates.

  • @simoid6246
    @simoid6246 6 місяців тому

    but what if the url not have limit and skip query

  • @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!

  • @defaultname5607
    @defaultname5607 6 місяців тому

    c'est pas plus facile getjson => create tab => read 10 first elements ?

  • @HowManyShrimps-g7z
    @HowManyShrimps-g7z Рік тому +1

    James, how much money Astro pays for your ad?

    • @JamesQQuick
      @JamesQQuick  Рік тому

      None at all :) Thanks for clarifying that!

  • @蹦太君-o4d
    @蹦太君-o4d Рік тому

    thanks >

  • @jasonwelsh417
    @jasonwelsh417 Рік тому

    You can tell this guy has never worked on a production database before

    • @JamesQQuick
      @JamesQQuick  Рік тому

      Lol why is that?

    • @jasonwelsh417
      @jasonwelsh417 Рік тому +1

      @@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 6 місяців тому +1

      ​@@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.