React Pagination in 7 minutes [ EASY ] | Pagination Tutorial

Поделиться
HTML-код
  • Опубликовано: 12 янв 2025

Комментарии • 294

  • @CodeBlessYou
    @CodeBlessYou  5 месяцев назад

    🎓Get FREE access to my upcoming Ultimate Node.js Course for the FIRST 100 students: forms.gle/8m9XA7kmc17nHfhz8 🚀

  • @codenamemoe9337
    @codenamemoe9337 Год назад +29

    This was an amazingly clear and concise video. Thank you for this and I hope you make many more in this exact style.

    • @CodeBlessYou
      @CodeBlessYou  Год назад +2

      Thank you. Actually I am working on Complete React JS course, If you are interested then you can register for that. For first 100 Students it will completely FREE.
      Fill This Form:- forms.gle/aBtV1aRdcbztDwF3A

  • @goodhandlestaken
    @goodhandlestaken 2 года назад +24

    Blown away by this, watched a few videos today on how to add some pagination functionality and they all go on for about 30 minutes.
    You had it explained in 7, so easy to understand too!
    Subbed

    • @CodeBlessYou
      @CodeBlessYou  2 года назад +1

      Thank you for your support ❤️😍

  • @ZubairKhan-eq5oq
    @ZubairKhan-eq5oq Год назад +3

    everything explained just in 7 min so amazingly, love u bro

  • @gandamraviteja7019
    @gandamraviteja7019 11 месяцев назад +3

    Great buddy you just made this pagination very easy for me
    wonderful explanation kudus

    • @CodeBlessYou
      @CodeBlessYou  11 месяцев назад +2

      Glad to hear that. Thank you so much❤❤❤

  • @MSRahmanSD
    @MSRahmanSD Год назад +5

    Absolutely amazing. Detailed and clear. Thanks a lot! Keep up your good work!

    • @CodeBlessYou
      @CodeBlessYou  Год назад +2

      Thanks for your support. Grateful for that❤❤

  • @suleimanhassan8579
    @suleimanhassan8579 Год назад +2

    perfect video for pagination so glad i didnt waste time on other videos

    • @CodeBlessYou
      @CodeBlessYou  Год назад +1

      Glad to hear that. Thank you so much

  • @w222k2
    @w222k2 Год назад +1

    damn, your code is very easy to understand, your voice too. Thank you verymuch

  • @yulius4527
    @yulius4527 Год назад +2

    The easiest and the fastest way pagination, also good core concept for beginner thankyou bro, subbed :D

  • @muzammilsiddiqui8771
    @muzammilsiddiqui8771 Год назад +3

    Bro you litrally break down those 30min long videos in 5min, that too with more clearer logic explanation than them. You deserve a subscribe 🤝

  • @ceciliatalone2056
    @ceciliatalone2056 Год назад +2

    Great video! Thank you for being so straightforward and clear

  • @nicolasdiaz6673
    @nicolasdiaz6673 6 месяцев назад

    As a newbie, I was avoiding implementing this feature as a I knew it'd give me a headache. After watching this, I can't wait to get it done today on my personal project. Thank you so much!

  • @plantleafboy
    @plantleafboy 7 месяцев назад

    Usually I watch multiple videos to understand concepts, your explanation is clear and makes sense. Great editing and format. Cheers NZ

    • @CodeBlessYou
      @CodeBlessYou  7 месяцев назад

      Glad to hear that❤❤❤

  • @cryptonicchronic8111
    @cryptonicchronic8111 2 года назад +3

    your channel will blow up buddy, just keep up the awesome work really impressed.
    only a few suggestions for future videos,
    1. keep them short like how your doing, crazy graphics and long intros just wastes ourr time eh
    2. keep repos as up to date as possible
    3. do updated versions because a lot of previous viewers will come back to see what youve come up with next
    4. if you run out of lessons to teach take requests and set up a telegram or discord to live chat with the people you teach!
    thanks for this video super appreciative and always stoked to see a new channel rise up on YT I started watching hashlips when he had 3k subscribers. you got this!

    • @CodeBlessYou
      @CodeBlessYou  2 года назад +1

      Thank you so much brother for this comments and suggestions. I will apply them as soon as possible. Really grateful for this support😇❤

  • @mamunahmed8113
    @mamunahmed8113 2 года назад +1

    I am from Bangladesh, I follow your channel, and your teaching style is really awesome, I have learned more easies way from your channel videos. We need more videos on javascript and React, Thanks, brother Love from Bangladesh

  • @manuelpineda9067
    @manuelpineda9067 2 года назад +8

    Man this is a great tutorial. Very helpful and to the point.

  • @Tombo272
    @Tombo272 7 месяцев назад

    Fantastic tutorial! I don't typically comment on videos, but I had to give you credit. This was better than several others I combed through. Was easy to follow, understand and build on top of. Whole video was great, good job!

    • @CodeBlessYou
      @CodeBlessYou  7 месяцев назад +1

      Glad to hear that❤❤❤

  • @nahomabraham748
    @nahomabraham748 10 месяцев назад +1

    The way you broke down the topic and made it super easy to follow along was incredible. I loved how you kept it short and precise

    • @CodeBlessYou
      @CodeBlessYou  10 месяцев назад

      Thank you so much for your support❤❤❤

  • @yofi2614
    @yofi2614 2 года назад +4

    I think that at 0:56, row number 10 is not really necessary to be a state, cause the post per page will never be changed as a result of some event, unless you directly change it manually, so you can just give it a regular variable :)

    • @CodeBlessYou
      @CodeBlessYou  2 года назад +2

      Yeah, Thanks for Suggestion😇❤

  • @jojugeorge3215
    @jojugeorge3215 3 часа назад

    Easy to understand. Thank you

  • @justyourusualkid6424
    @justyourusualkid6424 Год назад +2

    wow, superb explanation. So clean and precise. Thank you sooooo much , this helped me a lot 🥳

  • @judoScott
    @judoScott 8 месяцев назад

    Fantastic tutorial. This was so much easier than other solutions I've looked at and is exactly what I was looking for! Thank yoou so much!

  • @shaikhanas02
    @shaikhanas02 Год назад +1

    No where on the RUclips I found a video like this bro. Hatts off bro you made all what I wanted in this video. Thankyou so much

    • @CodeBlessYou
      @CodeBlessYou  Год назад

      Thank you so much for your support. Really grateful for that❤❤

    • @shaikhanas02
      @shaikhanas02 Год назад

      Bro Can u also add Next and Previous Button to it?

  • @LibriSonoro
    @LibriSonoro 11 месяцев назад +1

    Super tutorial! I will do my best to implement this for my project!

  • @reshadsemedzade1182
    @reshadsemedzade1182 7 месяцев назад

    bro that is amazing video! short, easy and understandable

  • @RitchieOfficiel
    @RitchieOfficiel Год назад +1

    Awesome tutorial! thank you from belgium

    • @CodeBlessYou
      @CodeBlessYou  Год назад

      Thanks for your support❤❤ Love from India

  • @aslan6921
    @aslan6921 2 года назад +1

    I am currently working on Countries REST API task and was looking for a simple pagination cause i did't want to display all 250 items on a single page. I can't wait to get to my laptop and implement this to my code, thank you so much !

    • @CodeBlessYou
      @CodeBlessYou  2 года назад

      Thank you for your support. Grateful for that buddy😇❤

  • @subaruLover475
    @subaruLover475 Год назад +1

    Best video on this topic. Subscribed!

    • @CodeBlessYou
      @CodeBlessYou  Год назад

      Thank you so much for your support❤❤

  • @HelloPrithiby
    @HelloPrithiby 11 месяцев назад +1

    Thanku sir for this tutorial, very easy to understand

  • @EpistemicFomo
    @EpistemicFomo 5 месяцев назад

    Great explanation! Thank you!

  • @kamalpurohit7158
    @kamalpurohit7158 Год назад

    what a effort bro , who don't have interest in programming , can also watch this and enjoy this video by your way of explanation, its great

    • @CodeBlessYou
      @CodeBlessYou  Год назад

      Thank you so much for your feedback❤ Really grateful for that😇😇

  • @lucianoschmidt2398
    @lucianoschmidt2398 2 года назад +6

    I have to thank you for make it possible for me to rest for the weekend. The real chad.

  • @MuneebaSaleem-o5m
    @MuneebaSaleem-o5m 6 месяцев назад

    Thankyou so much for explaining why and how things are happening!

  • @gyros9162
    @gyros9162 2 года назад +5

    Hi! You've made a big job which helped me a lot. It would be nice if you show us a way to create fancy pagination which looks like 1 2 3 ... 8 ... 18, 19, 20

  • @Dziejkoo
    @Dziejkoo Год назад

    I thought pagination is really complex but you explained that easiest possible way thank you

    • @CodeBlessYou
      @CodeBlessYou  Год назад +1

      Glad to hear that. Thanks for watching❤❤

  • @aya2222
    @aya2222 2 года назад +2

    Very simple and clear explanation. Thank you!

  • @francescoPace27
    @francescoPace27 Год назад +1

    You are our saver, thank you very much!

  • @mageshkannana8795
    @mageshkannana8795 Год назад +2

    Now I know pagination because of you thank you brother in addition to your project I have added previous, forward, first, last button. can you teach us how to add ellipsis when we have hundreds of pages

    • @CodeBlessYou
      @CodeBlessYou  Год назад

      Thank you so much for your support. I never done that ellipsis in pagination. But I think can do that by adding conditions. Sorry I don't know that properly

  • @christyphh
    @christyphh 5 месяцев назад

    Thank you for a very easy to understand video. I successfully apply this to my project. ❤
    I encountered a small issue with scrolling: when I clicked to change the page using pagination, it jumped to the top of the page, while my element was at the bottom. I fixed the problem using the useRef() and useEffect() hooks, so I wanted to share the solution for anyone who might need it:
    ``` import { useEffect, useRef } from 'react';
    // initial setup
    const Pagination = ({ ... }) => {
    const scrollPosition = useRef(0); // To store the scroll position before page changes
    useEffect(() => {
    // Restore scroll position after state update
    window.scrollTo(0, scrollPosition.current);
    }, [currentPage]);
    // the rest of the code
    ```
    }

    • @CodeBlessYou
      @CodeBlessYou  5 месяцев назад +1

      Great. Thank you so much for this solution❤❤❤

  • @SelamsewTeshome
    @SelamsewTeshome 9 месяцев назад

    Best tutorial on pagination ever.

  • @ohm6454
    @ohm6454 Год назад +1

    Bro this is awesome your explanation was very clear. Thank a lot

  • @50-shivamMittal
    @50-shivamMittal 11 месяцев назад +1

    bro you explain very well

    • @CodeBlessYou
      @CodeBlessYou  11 месяцев назад +1

      Glad to hear that brother❤❤❤

  • @АлексейЦ-ы4я
    @АлексейЦ-ы4я 2 месяца назад

    Thanks! It's very useful!

  • @romimaximus
    @romimaximus 2 года назад +2

    Thats was awesome crystal clear !!, ..very simple to understand ...thank you very much 😁👍

  • @jigsaw6642
    @jigsaw6642 Год назад

    watched this video, best explanation with animation, uses pure react with use effect hooks, effective usage, simple, i selected this to implement in my code. thanks

    • @CodeBlessYou
      @CodeBlessYou  Год назад

      Thank you so much for watching this tutorial❤❤

  • @MusicalOcean
    @MusicalOcean 2 года назад +7

    ADD "Math.ceil(totalPosts / postPerPage) - 1" in your pagination component if you are getting blank page on your last pag.

    • @letmeglaze
      @letmeglaze 8 месяцев назад

      or just use Math.floor(totalPosts / postPerPage)

  • @zeronl_abs
    @zeronl_abs Год назад +1

    This is a greate tutorial clear and concise

  • @vietanhnguyen2898
    @vietanhnguyen2898 4 месяца назад

    I subcribed for you. Thanks for your helpful knowledge!!!

  • @Hosain_Ahmed
    @Hosain_Ahmed 4 месяца назад

    Great tutorial. Thanks❤

  • @JustMe-sx7uz
    @JustMe-sx7uz Год назад +1

    You are the best! Thank you.

  • @irenek8150
    @irenek8150 Год назад +1

    This was really helpful, thank you so much!

    • @CodeBlessYou
      @CodeBlessYou  Год назад +2

      Thank you so much for your support. Really grateful for that❤❤

  • @sm_ali
    @sm_ali 2 года назад +1

    Thats awesome. you explanation is so awesome. After watch this video my concept about pagination is clear now. thank you so much for such an amazing video. ❤

    • @CodeBlessYou
      @CodeBlessYou  2 года назад +1

      Thank you for this nice comment ❤🙌

  • @ТимурТокумов-и1к
    @ТимурТокумов-и1к Год назад +1

    Amazing! Thanks for your work!

  • @luker8874
    @luker8874 Год назад

    Great Video! Very concise and straight to the point

  • @srishtikhobragade7693
    @srishtikhobragade7693 2 года назад +1

    It is very great tutorial for pagination explained in simple way 💯

    • @CodeBlessYou
      @CodeBlessYou  2 года назад

      Thank you for your support😇❤

  • @raveclipsbypayrave4578
    @raveclipsbypayrave4578 2 года назад +1

    Awesome! Thanks! It helped me with what I was working on!

  • @joja2174
    @joja2174 Год назад +2

    Teacher at college: IQJHSDFÏPJQXCPIJQF
    random guy i found on youtube: * actual tutorial *

  • @bunyameennurudeen173
    @bunyameennurudeen173 2 года назад +1

    Awesome plus very helpful and educative.
    Thanks Dev

  • @roxc23
    @roxc23 Год назад

    How come i didnt tough about slice omg, thanks for sharing this and maiking it easier to understand.

  • @Jaracara11
    @Jaracara11 2 года назад +1

    Excellent tutorial; simple and concise

  • @zainikram336
    @zainikram336 7 месяцев назад

    best video ever on pagination

    • @CodeBlessYou
      @CodeBlessYou  7 месяцев назад +1

      Thank you so much for your love❤❤❤

  • @ZettoChannel
    @ZettoChannel 2 года назад +1

    Thank you so much my friend, it works

  • @SaraGutiérrez-q4o
    @SaraGutiérrez-q4o Год назад

    Thank you, finally I could have understood pagintation

    • @CodeBlessYou
      @CodeBlessYou  Год назад

      Thanks for your support. Really grateful for that❤❤

  • @cooperburwell321
    @cooperburwell321 2 года назад +1

    Thank you so much for the concise explanation!

  • @wahidullah-karimi
    @wahidullah-karimi 2 месяца назад

    best explanation in entire youtube .
    sir make a video like this on add to cart functionality with redux toolkit and with context api.
    thanks sir I'm waiting for it.

    • @CodeBlessYou
      @CodeBlessYou  2 месяца назад +1

      It will take time. Because Currently I am working on the Node JS Course❤❤❤

  • @AdityaArya2207
    @AdityaArya2207 6 месяцев назад

    Thank you man very helpful

  • @predeator2562
    @predeator2562 10 месяцев назад +1

    This code is working if the posts are even...example
    If there are 33 posts I have to display 10 posts on each page then it is displaying only 3 pages means ie 30 posts ...the rest 3 post is not displaying...for this what to do...?

  • @ahnaffaiyaz1892
    @ahnaffaiyaz1892 2 года назад +1

    Great video, you explained this very well. Thank you!

    • @CodeBlessYou
      @CodeBlessYou  2 года назад +1

      Thank you so much for this comment❤

  • @chinchinooo6657
    @chinchinooo6657 7 месяцев назад

    So helpful thank you!

  • @stevendna8956
    @stevendna8956 2 года назад +1

    Thanks bro. Genius work. 🙏🙏🤩

  • @rekikhamza8904
    @rekikhamza8904 9 месяцев назад

    You earned a sub, thank you

    • @CodeBlessYou
      @CodeBlessYou  9 месяцев назад

      Grateful for that❤❤❤

  • @venkateshk7971
    @venkateshk7971 5 месяцев назад

    Awesome explanation brother 🤝👍

  • @FGA-47
    @FGA-47 Год назад +1

    Thanks man that really helpful

  • @lucaturgueniev
    @lucaturgueniev Год назад +1

    This was helpful, thanks!

  • @rafaelibarra280
    @rafaelibarra280 Год назад

    Very clear. I am already subscribed

  • @yofi2614
    @yofi2614 2 года назад +1

    Amazing! please if you can keep up the good work!

  • @farhanmuhammad5586
    @farhanmuhammad5586 11 месяцев назад

    thank you for the explanation sir😻

  • @pepsicolla123
    @pepsicolla123 Год назад

    Thank you sir, it helped me a lot!

  • @nurmuhammadyorov9775
    @nurmuhammadyorov9775 10 месяцев назад

    Very useful thank you bro

  • @ken2ker495
    @ken2ker495 Год назад +1

    i read the doc and it tell me the slice medthod has 2 params , the starting index and last index . It will cut the current array to a new array from the starting index to the last index - 1 . Is it right ? I need help

    • @CodeBlessYou
      @CodeBlessYou  Год назад

      Yes you are correct.The slice method is like taking a piece of a cake. Imagine you have a cake (an array), and you want to cut a slice from it.
      - The starting index is where you want to begin cutting.
      - The ending index is where you want to stop cutting (but not include that part).
      So, if you have an array like this:
      const cake = ["chocolate", "vanilla", "strawberry", "caramel", "lemon"];
      And you want to cut a slice from the second flavor to the fourth flavor (inclusive):
      const sliceOfCake = cake.slice(1, 4);
      The slice method takes a slice starting from the element at index 1 ("vanilla") and goes up to, but does not include, the element at index 4 ("caramel"). So, sliceOfCake would be:
      ["vanilla", "strawberry", "caramel"]
      It's like saying, "Give me a piece of the array starting from here and stopping just before there."

  • @RohitKumar-ev7tn
    @RohitKumar-ev7tn Год назад

    bro , this is the best I found .

  • @piyushgupta6290
    @piyushgupta6290 2 года назад

    Great Great help brother you saved the day!!!!

  • @lokeshvasnik6872
    @lokeshvasnik6872 Год назад

    Crazy Brother Amazing...

  • @HarishC-p2m
    @HarishC-p2m Год назад +1

    assume we have totally 1000 apps which is returned by the API and we can not load all the apps at once because it possess storage problem assume that right now iam some where in the 500th app page whatever the previous page apps are there are not required. i need to delete those and if i go back i should be able to get those as well.. for this sinario how could we achive

    • @CodeBlessYou
      @CodeBlessYou  Год назад

      Sorry I don't understand your question. Can you explain it with example?

  • @yousseftec8060
    @yousseftec8060 Год назад

    Bro You Are The Best ❤️

  • @sandeeppillai2890
    @sandeeppillai2890 2 года назад

    Superb video bro... Plesse make crud video of api with axios

  • @shaiksaifali1429
    @shaiksaifali1429 2 года назад

    very very thanks . it really helped me a lot .

  • @AryanRaj-zt6cq
    @AryanRaj-zt6cq Год назад

    You are genius. Thanks Bro

  • @aloktamrakar9541
    @aloktamrakar9541 Год назад

    Good explanation ❤

  • @jovem_guil
    @jovem_guil Год назад

    tip if you're making an API too: to improve the perfomance implement the pagination on your backend instead of getting all data and slice on frontend

  • @rizkaharizpradana8836
    @rizkaharizpradana8836 2 года назад

    simple to understand, thanks

  • @muhammadowais3499
    @muhammadowais3499 Год назад

    i don't know what happend in this video but it works

  • @natewalchenbach8413
    @natewalchenbach8413 2 года назад

    Very useful. Thank you.

    • @CodeBlessYou
      @CodeBlessYou  2 года назад

      Welcome and Thanks for this comment😇❤

  • @pwamoreno
    @pwamoreno Год назад

    This was awesome. What theme do you use?

  • @komalsethi3295
    @komalsethi3295 2 года назад +1

    Good one 👌👌

  • @Crypto_dropsss
    @Crypto_dropsss Год назад

    amazing bro !!

  • @UNDEREFFCT
    @UNDEREFFCT 7 месяцев назад

    Can someone please explain to me how is it possible to mutate the setCurrentPage state through props ? Because as we all know, data flow in react is uni-directional! Im confused! How its possible to mutate the parent component state in the child component ?

  • @minhthai9521
    @minhthai9521 2 года назад

    Very helpful ♥

  • @andrewaghoghovwia1948
    @andrewaghoghovwia1948 2 года назад

    Simple clear explanation.. thanks alot.. but what of a scenario where you have more than a 100 pages ?

    • @CodeBlessYou
      @CodeBlessYou  2 года назад +1

      1. You can manually add +5 and -5 button
      2. You can also add little input box for entering a page number and then display that posts.

    • @andrewaghoghovwia1948
      @andrewaghoghovwia1948 2 года назад

      @@CodeBlessYou Please I have another question. Is this approach better than making an api call to fetch each page? Thanks for your anticipated response

    • @jiseeeh
      @jiseeeh 2 года назад +1

      @@andrewaghoghovwia1948 this is obviously faster because you already have all data. so when you switch page it is already available whereas fetching data every page would make a little delay.

  • @emes3996
    @emes3996 2 месяца назад

    HI there, this was a very nice video, but i wanna ask
    if I have a search function for the list, can the search function still search from all data not from displayed data per page only?

    • @CodeBlessYou
      @CodeBlessYou  2 месяца назад

      For that you have to add search query in your backend and call that query when input a word in search box