How to Improve Performance in React with Code Splitting

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

КОМЕНТАРІ • 190

  • @arn4v_
    @arn4v_ 2 роки тому +270

    You don't have to export default for dynamic import() to work. You can instead do import('./CreatePort').then(module => module.CreatePost)

    • @IdandushHen
      @IdandushHen 2 роки тому +28

      you actually have to return object with default
      import('./CreatePort').then(module => ({default: module.CreatePost})) - like this

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

      @@IdandushHen you don't have to import/export anything, just have 1 file with 1 line of code and boom!

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

      @@KevinArellano So what's the correct method?

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

      @@davidchavarriamendez9091 The correct method is up to your case and your boss's case. Can't really choose a "correct" methods when you can do it any way and it works. Now the correct way in my opinion is functionless/serverless architect. Anywhere where microservices can come in and pick up the slack. I absolutely hate when there's a module that either does everything or doesn't do anything at all. Also monoliths are a big no no.

    • @leandrogtabak
      @leandrogtabak Рік тому +7

      @@jameswatadza8962 I don't even know why these people see videos that seem to be so below their level. They just come here to show themselves

  • @torstenmirow
    @torstenmirow 2 роки тому +120

    Actually it's easy possible to use named exports instead of default exports.
    Import function is simply an promise.
    lazy(()=> import('component/login').then(comp => comp.login))
    So no need to change the way you export functions.

  • @CarolinaNT
    @CarolinaNT 2 роки тому +5

    how i leaned so much in a 10 minutes video is out of this world. Thanks Pedro, you're awesome

  • @ramananr3529
    @ramananr3529 Рік тому +3

    Hey Thanks Man!!! Currently I am working on a project where performance is crucial. I am glad I came across this video and applied it on my project. Really helpful content, Have a great day.

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

      What is the result like?! I'm so curious, how much performance increase do you see?
      I'm really new to optimising and making it more faster.

  • @rahulkhatri8304
    @rahulkhatri8304 2 роки тому +3

    This is definitely increase your website performance.
    I used next/dynamic to import components.

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

    Hope you stay healthy as always and keep making these micro-learning videos, it literally helps us to cultivate out mindset of "An Expert is a Beginner who stays actively curious and never quits".
    I like the way you do like, instead of making one long hours big project tutorial, you instead guide us to the basic concepts based on most demanded frontend trends like Performance Optimization and React Hook Form the simplified way. Bravo!!

  • @henrynovoalondono2885
    @henrynovoalondono2885 2 роки тому +9

    Absolutely love these small 10 minute videos. To the point, and learned a whole lot. Thanks

  • @cutieshakira
    @cutieshakira 2 роки тому +5

    I didn't know about this concept, thanks for this! also your editing has gotten super clean!

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

    I have a mediun sized frontend project and this really helps. Thank you

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

    this is just point to point explanation. Loved it

  • @michaelantoni8323
    @michaelantoni8323 2 роки тому +6

    Great performance optimizations, hope you do this kind of videos more.

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

    Simple and straightforward explanation! excellent work👏

  • @masj7786
    @masj7786 2 роки тому +4

    I think I've learned from you in a couple of hours more than all these pointless Udemy 40+ hour courses

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

    Gracias Pedro! nuevo skill desbloqueado!

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

    Pedro, seu ingles esta bem fluente! E o seu conteudo e bem apresentado! Parabens!

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

    Very well explained in a practical manner

  • @Abhisumant03
    @Abhisumant03 2 роки тому +3

    New react course was damn good 😊😊

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

    Simply & straightforward! Love the explanation!

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

    Ohh, Pedro thanks for sharing this with us thank you so much I love that features, please we need a playlist from things like this, thank you again!!!!!

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

    Great vid! I recognized the Brazilian accent as the it started playing 😆
    Keep up the good work!

  • @eshw23
    @eshw23 2 роки тому +13

    Yo Pedro amazing video as usual. Good to see your still helping us learn to code while your a software engineer at Twitch!

  • @anton9410
    @anton9410 2 роки тому +3

    Great information, thank you for posting this video.

  • @maxplank1780
    @maxplank1780 2 роки тому +2

    What is the end value of performance you won? Have you calculated it? Or it's just fine thoughts that you read somewhere?

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

    Dude your content is amazing, the way that u explain things is really interesting.

  • @ZubairKhan-mb6rd
    @ZubairKhan-mb6rd 2 роки тому +1

    Good information on optimisation of a react app.

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

    I have always wondered how to implement this🤩. Always learning new things from you.

  • @aldotube88
    @aldotube88 2 роки тому +1

    Nice video, would have been good if you had the code linked in the description also though

  • @antoniobasilio319
    @antoniobasilio319 2 роки тому +6

    você é incrível! Merece todo o sucesso do mundo!

  • @priscillasilva6510
    @priscillasilva6510 2 роки тому +1

    Thank you so much for this video☺You explained it so well

  • @avro-vulcan
    @avro-vulcan 2 роки тому

    i opened a tab in my browser one year ago....on this topic....obviously i lose it among all the hundreds opened tabs 😂. i finally completed my react education...10x

  • @andrewaghoghovwia1948
    @andrewaghoghovwia1948 2 роки тому +8

    Hi Pedro..thanks for the invaluable resource. Please can you do a video on design patterns with examples. Thanks

  • @jesielpalacios
    @jesielpalacios 2 роки тому +1

    6:35 Actually React Suspense has been used with the same regularity throughout all versions of it's for as long as the hook exists, but it's ok :)

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

    Love this video man :-) well done with the simple explanation

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

    Hey man, I watched this video earlier and loved the concept of lazy loading.
    I am currently implementing it into my current project and am here to ask if lazy loading caches loaded components.
    Thanks, man.

  • @priyabansal9911
    @priyabansal9911 2 роки тому +1

    Please make a playlist -> how to improve

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

    As always brother didn't let us down!

  • @Thanveershah
    @Thanveershah 2 роки тому +1

    Jeez the quality ✔✔, What mic do you use?

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

    Please make more videos on how to improve the performance of react application

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

    Thank you from the bottom of my heart!

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

    nice man, finally i got it. Thanks.

  • @tan2cang93
    @tan2cang93 2 роки тому +2

    many thanks for your sharing. I have applied react lazy in my project. Howerver, there are so many named export components in project (~ 40-50 files), so I can not go into each Component to change export to export default. Fortunately, I found a package lazily on npm, it works the same as React lazy but will convert named export to default export.

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

    That was amazing, thanks a bunch!!

  • @aymenbachiri-yh2hd
    @aymenbachiri-yh2hd 4 місяці тому

    Thank you so much pedro

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

    thanks for the vid. I was wondering what theme do you use?
    Thanks

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

    Great content bro, thank you !

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

    Top notch as usual

  • @xesvitinho1231
    @xesvitinho1231 2 роки тому +3

    Muito daora mano, manda muito na programação e no ingles tb!!1 brabo

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

    Amazing explanation thanks man

  • @TruthSeeker23-m4o
    @TruthSeeker23-m4o Рік тому

    what theme are you using Pedro nice color combination

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

    Thanks! Great Job!

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

    It's very useful, thank you so much

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

    Pedro, do you have a tutorial on how to auth with Google and then register with an express API app? Thanks.

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

    Thanks Pedro

  • @TheMrtastee
    @TheMrtastee 2 роки тому +1

    great video!, is there a way to start loading in the background a lazy component after our normal component renders but before we actually requires the lazy ones?.

  • @ThColinPereira
    @ThColinPereira 2 роки тому +1

    This is super helpful!

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

    Excellent Video. Pedro, where are you from?

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

    Great Video bro... helps a lot.

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

    Nice explanation

  • @mahammadmansurali7442
    @mahammadmansurali7442 2 роки тому +1

    Can you also make a video on , how to improve performance in Nextjs..please

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

    Great vid bro. Thanks

  • @thecyberhobbit
    @thecyberhobbit 2 роки тому +11

    in your example you wrapped the entire Routes with the Suspense... what if like you said you want to only lazy load SOME of those routes... now with the entire Routes block is in the Suspense would that force everything to Lazy load?

    • @PedroTechnologies
      @PedroTechnologies  2 роки тому +16

      The only routes that will lazy load are the ones that you import using the Lazy method. Although they are inside of the suspense, it will only lazy load if you import with the lazy function

    • @thecyberhobbit
      @thecyberhobbit 2 роки тому +1

      @@PedroTechnologies !!! Nice makes sense thanks for the reply!

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

      @Ajkl Ajkl watch his video from the start and try to understand the the explanation of the purpose of lazy loading. He explained the purpose properly.

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

    Hi Pedro, thank you for sharing tips. I just want to clarify if this can be achieved as well with ? Which is rendering exact route

  • @lilizok4
    @lilizok4 2 роки тому +1

    awesome video !!

  • @Vedant-M
    @Vedant-M 2 роки тому +1

    Watching Pedro's videos never disappoints. Keep it up 👍🏼👍🏼

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

    Thank you bro!

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

    Brabo! Adoro esse canal

  • @xxvsvitorxx
    @xxvsvitorxx 2 роки тому +6

    Ótimo video! Poderia fazer um vídeo falando sobre o novo use hook e como isso impactará no React query?

    • @PedroTechnologies
      @PedroTechnologies  2 роки тому +4

      Vou fazer!

    • @cristhiancunha
      @cristhiancunha 2 роки тому +1

      @@PedroTechnologies só vim perceber que era br quando vi os comentários, ótima dicção e ótimo conteúdo, me lembrou bastante a forma como o conteúdo é gerenciado (talvez por debaixo dos panos não tenha nada a ver) pelas páginas agora no Nextjs 13.

  • @stressed-ashen-cat
    @stressed-ashen-cat 2 роки тому

    You can also code split packages using react loadable.

  • @jesielpalacios
    @jesielpalacios 2 роки тому +3

    I'd be great a React crud implementation with Redux and hooks, it's without classes, using containers, slices as well for explain as other ways or cases to use, idk, a tutorial of it without pain ❤

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

    Peidro tech sensei. Saludos desde Perú.

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

    Great content, congrats

  • @jpcc1223
    @jpcc1223 2 роки тому +3

    Ótimo conteúdo, obrigado!

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

    Thanks Man ❤❤❤❤

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

    This video explains really well why you should choose angular over react.. 😂😂😂

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

    Parabéns mano, muito bom o vídeo 👏

  • @wpxpert98
    @wpxpert98 2 роки тому +1

    Thank you

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

    Which theme you are using in this video

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

    This is amazing 🥰

  • @TheRavageFang
    @TheRavageFang 2 роки тому +1

    Just don't forget to add error handling in case on poor network lazy loading fails.

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

    Good video! Thank tou

  • @GB-vz8pk
    @GB-vz8pk 5 місяців тому

    amazing video!!!

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

    Good point

  • @salamikhalil9716
    @salamikhalil9716 2 роки тому +1

    Great content 👌

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

    Mano seu Inglês está brabo congratz.

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

    Nice thank you for that this is great

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

    Thanks a lot!

  • @gabrielgherman87
    @gabrielgherman87 2 роки тому +1

    Excelente vídeo! Valeu!

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

    Amazing .

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

    Does this affect the app when deploying it?

  • @user-xu9tb7oe2z
    @user-xu9tb7oe2z 3 місяці тому

    awesome!

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

    Thanks alot

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

    Is suspense really recommended in a actual large scale application ? It's still experimental...

  • @fadyfathey4315
    @fadyfathey4315 7 місяців тому

    THNX BRO

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

    How do you deal with paths that you request form the server and you display the path component in a react bundle? NOT ON A DEV SERVER!! YOU BUILD THE PROJECT AND SERVE IT USING EXPRESS OR WHATEVER. How do you manage that?

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

    Is suspense a ready to use and stable functionnality with react ? Because it has been introduced an experimental one for years now

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

    Hi Bro good explanation

  • @douglasbernardodev
    @douglasbernardodev 2 роки тому +1

    Very usefull man... thanks for share!

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

    Thanks

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

    can you lazy load components from an index file?

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

    Awesome video