React Lazy Loading & Code splitting

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

КОМЕНТАРІ • 137

  • @rjc4200
    @rjc4200 3 роки тому +9

    The best Lazy loading explanation I have ever seen. Short, crisp, to-the-point. And I love the way you describe . Thank you very much !! :)

  • @DivyanshBatham
    @DivyanshBatham 5 років тому +108

    The error was not because the component was not loaded, it was a "Duplicate Declaration Error" 😂 3:29

    • @rotimibest8530
      @rotimibest8530 5 років тому +1

      exactly.

    • @WomboBraker
      @WomboBraker 5 років тому +2

      I was like wtf, how is this convoluted. Thank you for pointing it out, i thought i was going insane.

    • @ssk1724
      @ssk1724 4 роки тому

      @@WomboBraker me too.

    • @Sahilbc-wj8qk
      @Sahilbc-wj8qk 4 роки тому +4

      It was suspens of his video.

    • @supersu6138
      @supersu6138 3 роки тому

      Me too thought wtf is that

  • @alexgochenour8740
    @alexgochenour8740 3 роки тому +3

    Simple, straightforward, effective. Thanks, TechSith!

  • @vinayjoshi2
    @vinayjoshi2 4 роки тому

    Thanks for giving short, fast and easy example for lazy loading

  • @dulansudasinghe868
    @dulansudasinghe868 4 роки тому +1

    Clear, concise and condensed. Best tutor and tutorial series ever

  • @mohdhaseeb6139
    @mohdhaseeb6139 2 роки тому

    Your Tutorial is ULTRA MAX PRO CRYSTAL CLEAR. THANK YOU !!

  • @Tesla12322
    @Tesla12322 2 роки тому

    best lazy loading explanation

  • @rohitkudalkar92
    @rohitkudalkar92 5 років тому +2

    Bro you re the best in Js, I love THE simplicity in your video tutorials, Thanks, Love from Mumbai

    • @Techsithtube
      @Techsithtube  5 років тому +1

      Thanks Rohit. Keep on learning! love from San Jose

    • @caiobueno413
      @caiobueno413 3 роки тому

      @@Techsithtube ffgfgfgh

  • @suprabhatkumar5478
    @suprabhatkumar5478 2 роки тому

    I am watching you first ever video and I realllllllyyyyy loved it..

  • @farzadsole3784
    @farzadsole3784 3 роки тому

    UA-cam's comments section is lazy loaded actually 😜
    Excellent tut, thanks for sharing

  • @kotletschabowy8226
    @kotletschabowy8226 4 роки тому

    Gr8 tutorial. Greetings from Poland! 🇵🇱

  • @schopra81
    @schopra81 3 роки тому

    Thanks Mate. It was actually helpful.

  • @parushanaidoo9183
    @parushanaidoo9183 2 роки тому

    Thank you! I really appreciate your videos

  • @paulonteri
    @paulonteri 4 роки тому +1

    You explain so well!!

  • @roshnikutty4252
    @roshnikutty4252 6 років тому +3

    wow wow! Great example!!

  • @leon-do
    @leon-do 4 роки тому

    short and to the point!

  • @devolee8302
    @devolee8302 5 років тому +2

    wow you nailed it in such a short time..! just amazing!

  • @willyamrb
    @willyamrb 4 роки тому +3

    It's exactly what I need, thank you!

  • @soumadip_banerjee
    @soumadip_banerjee 2 роки тому

    Loved the explanation..

  • @reehanq
    @reehanq 5 років тому +2

    Thanks Alot for your efforts for easy understand the concept. Hats off . Please it's kindly request you explain react on server side rendering

    • @Techsithtube
      @Techsithtube  5 років тому +1

      I will create a video on server-side rendering for react. you need to know node for that. Thanks for watching Reehana.

  • @hujingtao1
    @hujingtao1 5 років тому +1

    Your explanation is so great! thanks so much

  • @kamilp1567
    @kamilp1567 2 роки тому

    Helped a lot, thanks!

  • @haydenng688
    @haydenng688 3 роки тому +1

    Thanks for your sharing

  • @JavierGarcia-ck3wx
    @JavierGarcia-ck3wx 4 роки тому +1

    Amazing, crystal clear

  • @roarknguyen3192
    @roarknguyen3192 2 роки тому

    Thanks so much guy, this is awesome!

  • @minhajap1634
    @minhajap1634 3 роки тому

    Thank you. It helped Me A Lot

  • @musictrader8990
    @musictrader8990 4 роки тому

    Simple and clean explanation. Thanks a lot

  • @noamkleiner8749
    @noamkleiner8749 5 років тому +1

    Good one, makes my app load much better.

  • @rushivani454
    @rushivani454 6 років тому +1

    Please make a videos of developing real time small react online-shopping project. Which includes modules like search bar, menu bar, product details page, cart, chechout, order confirmation, etc

  • @letoan285
    @letoan285 6 років тому +1

    Great job. I wish you have a free react-typescript course to building an application.

  • @inaccessiblecardinal9352
    @inaccessiblecardinal9352 5 років тому +1

    You already had the network tab open. would have been a good time to observe the js requests without async modules and with... literally is the point. Otherwise good stuff! Very useful technology.

  • @mayurjoshi952
    @mayurjoshi952 5 років тому

    Thank you, more clear with the last example!

  • @prabu106
    @prabu106 5 років тому +1

    Great. Nice tutorial

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

    🔥

  • @andreas.samson
    @andreas.samson Рік тому

    Thanks man!

  • @TheAppAlchemist
    @TheAppAlchemist 5 років тому +1

    Thanks

  • @sunnychaudhary1507
    @sunnychaudhary1507 3 роки тому

    Really helpfull and appriciable. Thanks

  • @neerajagrawal709
    @neerajagrawal709 4 роки тому

    Very nice video, well explained, love the way you explain the thing, you made difficult to easy to understand, keep posting, love you.

  • @Bobabhishek
    @Bobabhishek 3 роки тому

    Good stuff

  • @ramukumar8128
    @ramukumar8128 5 років тому +1

    Very finest channel for me Thank u

    • @Techsithtube
      @Techsithtube  5 років тому +1

      Thanks for a nice comment Ramu

  • @david-tracy
    @david-tracy 2 роки тому

    awesome

  • @StockWithSayee
    @StockWithSayee 2 роки тому

    Great Video!

  • @SwatiSingh-ry6gu
    @SwatiSingh-ry6gu 4 роки тому +1

    Very well explained. A big thankyou for this. Can you please make a video on redux-form?

    • @Techsithtube
      @Techsithtube  4 роки тому

      Swati, sure I will add to my queue. thanks for suggesting..

  • @sonuchhahar
    @sonuchhahar 2 роки тому

    Thanks!!

  • @ruchirai5775
    @ruchirai5775 5 років тому +1

    awesome !

  • @shafiqshams3065
    @shafiqshams3065 2 роки тому

    Very nice sir.

  • @jesusmedinavillalpando8014
    @jesusmedinavillalpando8014 4 роки тому +1

    Do you recommend in all my imports of Componentes into another ones, use React.lazy and Suspense?

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

    Wanna Know Which fontFamily and extension are you using in your vscode because the font looks different than original and familiar to codesanbox

  • @tajpouria
    @tajpouria 5 років тому

    Except first error rest was good trchsith!

  • @TheAppAlchemist
    @TheAppAlchemist 5 років тому +1

    amazing video

    • @Techsithtube
      @Techsithtube  5 років тому

      THanks Hussain for a nice comment . :)

  • @bikerfrommars415
    @bikerfrommars415 6 років тому +1

    Cool!

  • @tiendatnguyen6239
    @tiendatnguyen6239 2 роки тому

    nice video. thank sir.

  • @syedmuhammadaliraza3069
    @syedmuhammadaliraza3069 3 роки тому

    Really nice🤩🤩

  • @Yan-rv8mi
    @Yan-rv8mi 4 роки тому +1

    3:31 This error is due to a duplication declaration, not what you meant to show. I understand what you're trying to teach, but please claim this error so that it doesn't mislead the ones who are new to the field.

  • @ГеоргийРукомин
    @ГеоргийРукомин 5 років тому +1

    Thank you.

  • @CASMANWHAT
    @CASMANWHAT 6 років тому

    lol i clicked because of the thumbnail. i liked because of the content. :)

  • @marcellrusdianto5278
    @marcellrusdianto5278 3 роки тому

    really great sir, thankyou :)

  • @mayobanexlu
    @mayobanexlu 4 роки тому

    well explained feature! thank you a lot!

  • @doaashafik3073
    @doaashafik3073 6 років тому

    thank you are great this playlist is so useful

  • @leanprogrammer
    @leanprogrammer 5 років тому

    cool!!

  • @RethinkingUI
    @RethinkingUI 5 років тому

    Thanks Sir.

  • @gb7586
    @gb7586 3 роки тому

    can i rename the bundle that's build from this code splitting so i can use it to cache to serviceworker ? because i've read the documentation but didn't find anything about that

  • @AlexanderSavchenko91
    @AlexanderSavchenko91 5 років тому

    Thanks a lot

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

    Hey I have an app that adds an item to list on one page to the database and it directs to another page with a table of rows with the inserted item, however when I first load the table of rows it doesnt show me the added item until I refresh the page again, do you think lazy loading is gonna solve it

  • @hemantmali4938
    @hemantmali4938 4 роки тому

    It sounds taxi tutorial, content is cool

  • @Godwin335
    @Godwin335 6 років тому

    Can you please tell me what is the theme/font you are using for VS code? I love they the way fat arrows are looking in your theme.

  • @aaaaaaa596
    @aaaaaaa596 6 років тому

    Another great video !!!!

  • @NikhilMahirrao
    @NikhilMahirrao 5 років тому

    Is it also lazy load after webpack bundle? I think video should cover nested lazy load too.

    • @Techsithtube
      @Techsithtube  5 років тому

      basically any file that you lazy load is a separate bundle.

    • @NikhilMahirrao
      @NikhilMahirrao 5 років тому

      @@Techsithtube So is it replacing webpack lazy load?

  • @DevDiegoSanches
    @DevDiegoSanches 5 років тому

    It is so amazing. TKS boy

  • @madlizardnthat
    @madlizardnthat 3 роки тому

    video starts at 0:43

  • @abdalmonemabdalrahiem1189
    @abdalmonemabdalrahiem1189 4 роки тому

    OMG dude , your mouse cursor freaking me

  • @MrRuchir23
    @MrRuchir23 6 років тому

    Great...

  • @clumsycoco
    @clumsycoco 5 років тому +1

    How exactly is code splitting achieved here?
    Good stuff as usual!

    • @Techsithtube
      @Techsithtube  5 років тому +2

      when you use lazy, it creates a separate package that is lazy loaded . So you have split the code into two separate packages instead of usual one package.

    • @piyush96arora
      @piyush96arora 5 років тому

      @@Techsithtube i didn't understood your reply...could you explain?? And sir please make vedio on renderprops

    • @alexjackson1
      @alexjackson1 5 років тому +2

      Piyush arora using React.lazy(importFunction) is an instruction to the build process to save the code imported by importFunction into a different file which is sent to the browser only when the content is rendered.

  • @nguyenquoc0310
    @nguyenquoc0310 3 роки тому

    I have a question.
    In my component, i have a list posts/articles.
    First, when loading page will display a list.
    Then, when i scroll by mouse, page will load more a new posts.
    Can i use lazy and suspense to do this?
    How to ?
    Thanks!

    • @Techsithtube
      @Techsithtube  3 роки тому

      That is a little different. what you are referring is to make api call on scroll, which you can do without using lazy loading.

    • @nguyenquoc0310
      @nguyenquoc0310 3 роки тому

      @@Techsithtube if i use react-lazyload then can do this, but i wanna use lazy and suspense to do this.
      React lazy and suspense are only using to load component or route. So, when component is loaded, all records (list posts/articles,..) are displayed.

  • @alexon2010
    @alexon2010 5 років тому

    I can not associate using ReactJS when I need to use the same as SSR, I see many tutorials, but they do not explain how the React SSR relationship would be and for example the use of http2, https, I made a small code in the nodejs, serving static files like the http2 protocol, but I do not know how I would do this with React SSR using lazy, suspense ...... ect ......

  • @doug1727
    @doug1727 6 років тому

    Will there be a second api call from the client to fetch the code for MyComp separetely?

    • @Techsithtube
      @Techsithtube  6 років тому

      Yes that is the point. rather than getting everything at once. load things as needed.

  • @nhim1705
    @nhim1705 6 років тому

    Good video. But the first error is a different one. You redeclared a variable on line 4

  • @volver5451
    @volver5451 4 роки тому

    this guy has a really good accent for an indian

  • @AmarjeetKumar-xr2gf
    @AmarjeetKumar-xr2gf 3 роки тому

    I have a two react app with its own route and redux...and I have a third react app say main react app where I need to call other two on click of some button and load the respective app and it should do it's own job

  • @Hasansaid51
    @Hasansaid51 4 роки тому

    This is not that bad, everyone I talked to made it seem like this was very difficult....

  • @hatrick3117
    @hatrick3117 6 років тому

    So for example I have a list of apps on my website (now they just loading by BrowserRouter), some of them are pretty big, so should I apply a lazy load to them if my website is slow? In most cases I saw things on website loading in old fashion way (with page refreshing), should I do that?
    Can someone help?

    • @Techsithtube
      @Techsithtube  6 років тому

      Yes, even if your package is too big that you are loading by Browser Router. Because otherwise that will be loaded with the main app which would be slower the performance of the main app. the advantage is that separate teams can work on each microApp. Again , it all depends on your architecture and domain.

  • @rezarst5734
    @rezarst5734 2 роки тому

    what if i want to unload the lazy component after im done with the component?

  • @islamsaied6484
    @islamsaied6484 5 років тому +3

    truly this man is awesome he made my love with react Allah bless you

    • @usamaliaquat4751
      @usamaliaquat4751 5 років тому

      copy from dan abromov talk

    • @einfacherkerl3279
      @einfacherkerl3279 4 роки тому +1

      Stop bringing religion into everything. Why you need to refer to your God to appreciate his work? Does he or anyone making this video believe in your God?

  • @chrspinto
    @chrspinto 5 років тому +2

    Why the Freddie Mercury pic in the thumbnail? :)

    • @Techsithtube
      @Techsithtube  5 років тому +1

      It was after I saw him movie trailer and I am a big fan of queens

  • @sayedabdulkarim7086
    @sayedabdulkarim7086 5 років тому

    when using create-react-app in vscode, terminal crahes everytime.How to fix it?

  • @improveliving3987
    @improveliving3987 5 років тому

    hello sir
    I need your help
    After getting a successful response from API, I want to change the page/load a new component in the browser but didn't find the correct way to do so.
    So please help regarding this.
    Example-
    axios.post('api.staging.goplannr.com/v2/user/otp/generate', this.state)
    .then(response=> {
    console.log(response);
    return(
    )
    }
    OTP is my component but in the browser, it is not working and also not showing any response.

  • @alexon2010
    @alexon2010 5 років тому

    I even understand the concept of lazy component, but how would I do the rendering relation with https server, https, I even have a code that still does not have much control over the rendering of html, css, js, but the same works !! ! How to have more control over this my code node http2, http and how do I relate this with react to offer rendering of componenentes in http2, https
    "
    import fs from 'fs';
    import path from 'path';
    import http2 from 'http2';
    import mimeTypes from './mime-types.json';
    const key = fs.readFileSync('./security/cert.key');
    const cert = fs.readFileSync('./security/cert.pem');
    const server = http2.createSecureServer({key, cert, allowHTTP1:true});
    const {HTTP2_HEADER_PATH, HTTP2_HEADER_METHOD, HTTP_STATUS_NOT_FOUND, HTTP_STATUS_INTERNAL_SERVER_ERRO, HTTP2_HEADER_STATUS} = http2.constants;
    const PUBLIC_FILES = __dirname+'/public';
    function fntRespondErrorStream(err, stream) {
    if(err.code === 'ENOENT') {
    stream.respond({':status':HTTP_STATUS_NOT_FOUND});
    }
    else {
    stream.respond({'status':HTTP_STATUS_INTERNAL_SERVER_ERRO});
    }
    stream.end();
    }
    function fntContetType(file_extensao) {
    let contentMimeTypes = '';
    if(file_extensao !== null) {
    let contentMimeTypes = mimeTypes.filter(res => res.extensao === file_extensao);

    for(let i of contentMimeTypes){
    contentMimeTypes = i.contentType;
    return contentMimeTypes
    }
    }
    }
    server.on('error', (err) => console.error(err));
    server.on('stream', (stream, headers) => {
    const reqPath = headers[HTTP2_HEADER_PATH];
    const reqMethod = headers[HTTP2_HEADER_METHOD];
    const pathFile = path.join(PUBLIC_FILES, reqPath);
    console.log(reqPath);

    if(reqPath === '/') {
    const file = `${pathFile}index.html`;
    stream.respondWithFile(file, {'content-type':'text/html', ':status':200}, {onError: (err) => {fntRespondErrorStream(err, stream)}});
    }
    if(reqPath !== '/') {
    let contentTypeValue = fntContetType(path.extname(pathFile).split('.')[1] || null);
    const file = `${pathFile}`;
    stream.respondWithFile(file, {'content-type':`${contentTypeValue}`, ':status':200}, {onError: (err) => {fntRespondErrorStream(err, stream)}});
    }
    });

    server.listen(8090, () => console.log('Servidor HTTPS Rodando na porta 8090'));
    "

    • @Techsithtube
      @Techsithtube  5 років тому

      I didnt get your question. Do you want to lazy load here in this code?

  • @naveenkumar-vb8tp
    @naveenkumar-vb8tp 6 років тому

    techsith,, why are you not uploading any videos on angular?? please upload.

    • @Techsithtube
      @Techsithtube  6 років тому

      I actually forgot lot of angular and I am relearning it , especially newer version of it. I will reboot the series early next year. Thanks for a reminder. :)

    • @naveenkumar-vb8tp
      @naveenkumar-vb8tp 6 років тому

      @@Techsithtube thanks for your reply

  • @atxorsatti
    @atxorsatti 5 років тому

    What is this indent extension?

    • @Techsithtube
      @Techsithtube  5 років тому

      I am using prettier extension of vsCOde

  • @rhimanshu6288
    @rhimanshu6288 2 роки тому

    What is the benefit of using this ?

  • @IMADABOULHOUDA7
    @IMADABOULHOUDA7 2 роки тому

    What about chunk the code in react

  • @novoicenoform6761
    @novoicenoform6761 6 років тому

    Is that Freddie Mercury on your thumbnail ?

    • @Techsithtube
      @Techsithtube  6 років тому +1

      Yep its him :)

    • @novoicenoform6761
      @novoicenoform6761 6 років тому

      @@Techsithtube I've been obsessed to watch his biopic for a while now. Now wherever I go Freddie Mercury is showing up!!

  • @arjunholmie
    @arjunholmie 2 роки тому

    Got a type error and it didnt work but I got the point and I guess thats what matters

  • @Vietnamcamping89
    @Vietnamcamping89 5 років тому

    why he isn't show the network to see the lazy component ?

  • @AmeerHamza-cj7gf
    @AmeerHamza-cj7gf 4 роки тому

    You are importing MyComp directly then defining it as const for lazy load. That's what, that error meant. Beginners are watching these kind of videos. Please double check your content bro before posting on internet.

  • @novanoskillz4151
    @novanoskillz4151 3 роки тому

    dumbest intro ever...for those who dont know what lazy loading is...its exactly what it sounds like, lazy loading...... gee thanks, i guess i learned all i need to know and can go test on this stuff now!! lol

  • @valikonen
    @valikonen 4 роки тому

    The example is very poor, everybody need to load something lazy in router. Very hard find a original tutorial, everybody copy from everybody and we have just todo apps. If you know Angular, tell me, it's possible to load something in background?

  • @MrSuhas1
    @MrSuhas1 4 роки тому

    Ii just explanation from website content nothing other than that..

  • @ShashwatSingh19
    @ShashwatSingh19 5 років тому

    1 down vote for the fake accent

  • @cristianouzumaki2455
    @cristianouzumaki2455 4 роки тому

    poor video