Code Splitting Made Simple

  Рет қаралды 45,596

Jack Herrington

Jack Herrington

Күн бұрын

Пікірлер: 123
@yoyo26-34
@yoyo26-34 2 жыл бұрын
Hi, very good thks. For those who are using typescript, for async load component (@9:44) you can type the useState like this : const [MyDefaultComponent, setMyDefaultComponent] = useState();. Then to import the component (no need the WrapperClassFunction) . Juste create the onLoad function inside your App like this : const onLoadComponent = async (): Promise => { const theComponent = (await import("./MyDefaultComponent")).default; setMyDefaultComponent(() => theComponent); }; This prevent react from crashing with the wierd error 'expecting string, received object'
@Nomak111
@Nomak111 3 жыл бұрын
Amazing video, please continue covering topics like this. I feel like once channels get bigger they focus on content that is accessible to broader audiences and it's all just intro to this and that instead of advanced topics. Your's is one of the few channel's that produces quality content for people not on the beginner level. Bought your book to support, good stuff as well.
@jherr
@jherr 3 жыл бұрын
Thank you sooooo much!
@michaelharveymusic
@michaelharveymusic 2 жыл бұрын
I second this, i love the deep dives you do!
@theworld5937
@theworld5937 2 жыл бұрын
You are one of the best teachers of React. So much clearer than many others. Your font size is perfect and large enough and love the split screens. Don't think I can ever approach your level of mastery of React no matter how many years. Some people just think logically and some are more right brained. Thanks for your tutorials and I am a subscriber.
@sanzhar.danybayev
@sanzhar.danybayev 3 жыл бұрын
Jack, thank you for what you're doing! You're such an incredible teacher! I can clearly see that huge experience and wisdom that you posses ( btw I've been software engineer for 7 years) . What a luck to have you!
@jherr
@jherr 3 жыл бұрын
Thanks! Lucky to have your feedback and viewership!
@alex-vukov
@alex-vukov 2 жыл бұрын
Thank you very much for the always great tutorials! I didn't know about the loadable components library and it looks really useful! One small remark - at 06:15 renaming the Webpack chunk to a fixed string called 'utilities' is not optimal for cachebusting because if the utilities file changes the user will have to clear the browser cache to get the new change.
@RachidBoudjelida
@RachidBoudjelida 2 жыл бұрын
damn I have been doing react for little over 3 years now, but every video I learn something new
@pratamaa.s.4356
@pratamaa.s.4356 3 жыл бұрын
Thanks Jack! +1 subscriber as soon as I saw "advanced frontend" in your KZbin banner,. One small suggestion, if you could create a playlist named like "advanced frontend" or "junior to intermediate frontend", to cover these kind of topics that we must have to level up our frontend game.
@marcelsdev
@marcelsdev 3 жыл бұрын
Thanks Jack. This really helped me understand and clarify a few things that I was struggling with. Seeing it in practice with your explanations really helps filling in the gaps.
@waqasrana5734
@waqasrana5734 2 жыл бұрын
you the gem i really thought that i can not do any thing. my collegues are doing exciting things and i don't know how to learn them then what luck to have you thank you love you .
@jherr
@jherr 2 жыл бұрын
Awww thank you!!
@igotbit9454
@igotbit9454 2 жыл бұрын
Yes! loved this talk. not talked about much out there. thx!!!!!!!
@mani8586
@mani8586 3 жыл бұрын
Again TOP Content from Jack...like the way you explain the content so easily
@gamingmobility8734
@gamingmobility8734 2 жыл бұрын
I was trying to find a way to use Nextjs to have both a website, and a dashboard for the sites admins. I couldn't find a way to keep it separate anywhere. After going to the admin route forcing login and authentication then using this loadable component did the trick! Thank you!
@kalyan4255
@kalyan4255 2 жыл бұрын
Very Informative Video! Please keep doing more videos
@TavoZapata
@TavoZapata 3 жыл бұрын
Great stuff! Love the way you explain these core concepts
@bythealphabet
@bythealphabet 3 жыл бұрын
Great video Jack, loving the part of module Federations.
@walidklai2417
@walidklai2417 2 жыл бұрын
The best React channel, Period. Thank you Jack .
@jasonthorpe3470
@jasonthorpe3470 3 жыл бұрын
If you want to store a React.FC in a useState, you don't need a fancy wrapper class -- just need to wrap it in an anonymous function, as in `const [myComponent, setMyComponent()] = useState( () => () => Loading); setMyComponent(() => () => My component has arrived) ` The reason this broke your first example in the "manually wrapping async loaded react components" section is that setState allows you to lazily set the state (i.e. in case the default value is expensive to calculate) so it lets you set the state (either initially or later with the provided setter) by giving it a function that will eventually return the state -- which it will only call once (e.g. so the initial state doesn't get calculated durning every render cycle). Plus `setState( () => MyComponent)` is much easier to remember than `setState(myFancyComponentWrapperForFunctionalComponenttMangedWithUseState(MyComponent))`
@jherr
@jherr 3 жыл бұрын
Oh, yeah, you're right. Facepalm. Ah well. Still better to use loadable.
@mkman
@mkman 3 жыл бұрын
That IS a gorgeous header! No wonder the product team wanted a piece of that action 😄
@jherr
@jherr 3 жыл бұрын
Hahaha, absolutely!
@rohan_webdev
@rohan_webdev 2 жыл бұрын
This is beyond any orther React video on KZbin. Full indepth I just love it ❤️💯🫡🫡. Thanks Jack 👍🙌😀
@appuser
@appuser 2 жыл бұрын
Very interesting. I wonder how/if this has changed much since January. Thanks Jack, this helped me a lot!
@guilhermegirardi
@guilhermegirardi 3 жыл бұрын
Awesome video! Regards from Brasil!
@shike769
@shike769 2 жыл бұрын
I have nothing to say than Amazing, blow my mind away 🤯
@Mark_MKII
@Mark_MKII 2 жыл бұрын
I’ve been doing front-end dev for a quite a while, and finally have the opportunity to more forward-thinking work. Some of your explanations really clear up ambiguous concepts that are rarely expressed clearly. (A friendly note about the intellisense tooltips that seem a little overly aggressive in showing their lovely help text - they often obscure the code you’re trying to show, and in really bad cases instill a feeling of inexplicable anxiety)
@jherr
@jherr 2 жыл бұрын
Yeah, I've started turning them off for screencasts. Sorry about that.
@ranganathdevaramani2966
@ranganathdevaramani2966 3 жыл бұрын
Great content as usual. Please make a video on next js bundle analyzer and how to reduce the bundle size
@electronicbasics1856
@electronicbasics1856 3 жыл бұрын
i think that i will let my future self make the tests/comments/code splitting for me :)
@angelprieto2001
@angelprieto2001 3 жыл бұрын
Thank you very much Sir, as always an amazing job!
@RakeshKumar-bq3mf
@RakeshKumar-bq3mf 3 жыл бұрын
Awesome content. Appreciate great efforts.. Thanks Jack...🙂
@shubhamlatiyan7972
@shubhamlatiyan7972 3 жыл бұрын
Thank you Jack, for the awesome information
@ahmedChebilahmed19chebil
@ahmedChebilahmed19chebil 3 жыл бұрын
nice content as usual ❤️. Thank you for the nice information
@balzale
@balzale 3 жыл бұрын
Awesome vid, Jack!! Love your custom bash/zsh. Can you please share how to customize like that? THANKS!!
@jherr
@jherr 3 жыл бұрын
iTerm2 with zsh/oh-my-zsh with oh-my-posh with powerlevel10k_rainbow and SpaceMono NF
@SIRISH1990
@SIRISH1990 3 жыл бұрын
Jack, thanks for all the stuff you do. can you also do a tutorial for securing electron app with keycloack.
@BarryMichaelDoyle
@BarryMichaelDoyle 2 жыл бұрын
I've seriously learnt a lot from this! Is there a TS example of the `loadComponent` function that you've created?
@jherr
@jherr 2 жыл бұрын
You'd have to declare the external module in your app.
@BarryMichaelDoyle
@BarryMichaelDoyle 2 жыл бұрын
@@jherr figured that'd be the case, thanks man!
@jherr
@jherr 2 жыл бұрын
@@BarryMichaelDoyle It's one of the disadvantages of runtime deps as opposed to build time deps.
@umairasad3896
@umairasad3896 5 ай бұрын
I am really impressed by your theme. What theme are you using?
@geneartista9714
@geneartista9714 2 жыл бұрын
Awesome as always but I wanna know it`s best use case on a project
@ashish_prajapati_tr
@ashish_prajapati_tr 3 жыл бұрын
an amazing and very important topic 👍👍
@rishabhjain5135
@rishabhjain5135 2 жыл бұрын
hi , nice tutorial. have a question - when to use this dynamic loading of components. Is there is any specific criteria for this or we can use whenever we want??
@jherr
@jherr 2 жыл бұрын
I can't think of any technical criteria that says that you can't use it when you want.
@rishabhjain5135
@rishabhjain5135 2 жыл бұрын
@@jherr ok , so what's the difference between importing components normally vs importing asyncronously ?
@大盗江南
@大盗江南 2 жыл бұрын
Hi Jack, thx so much for this great video. but i have a little suggest :) The title doesn't correspond to the content. and this is for advanced level. i thought this is a tuto for splitting complex code. plz correct me if im wrong. thx again for all those wonderful videos.
@nakulnagariya7736
@nakulnagariya7736 3 жыл бұрын
Amazing, thanks Jack
@SahilRajput03
@SahilRajput03 2 жыл бұрын
such an amazing video!!
@danishansari5746
@danishansari5746 Жыл бұрын
There is an issue with React Lazy loading is that when ever we deploy the code the chunk file names are getting changed because of that the user gets the blank page. User will have to refresh the page or our may be have some code that will automatically refresh that page Hey Jack for React Lazy loading is there way to keep chunk names same and not to write extra code for auto reloading when ever the code is deployed and user is able to use latest code
@haicoders737
@haicoders737 2 жыл бұрын
very nice video, btw , what kind of font and theme do you use in vscode
@jherr
@jherr 2 жыл бұрын
Night Wolf [black] and Operator Mono.
@MrEffg
@MrEffg 3 жыл бұрын
Thank you, Jack! Top content in calm manner as always! I wonder how could one leverage module federation in monorepo app or are there best practices on how to share code in monorepo app between packages (without bit . dev)
@MediumSizeNoob
@MediumSizeNoob 2 жыл бұрын
Great one Sir! Can you share the theme and font you are using?
@jherr
@jherr 2 жыл бұрын
Night Wolf [black] and Operator Mono
@vengateshvaidyanathang550
@vengateshvaidyanathang550 Жыл бұрын
Good video.. Can you tell us the vscode plug-ins you are using as a pro dev
@PickleRiiiiiiick
@PickleRiiiiiiick 2 жыл бұрын
Fantastic. I'm curious how this will work with Vite.
@Ahmed-cy4jp
@Ahmed-cy4jp 3 жыл бұрын
What’s your VSCODE theme?
@jherr
@jherr 3 жыл бұрын
Night Wolf [dark] and Operator Mono.
@kalyanapasupathyvenkataraju
@kalyanapasupathyvenkataraju 3 жыл бұрын
Absolutely wonderful
@oussamasadiki7377
@oussamasadiki7377 Жыл бұрын
how about Vite?
@rathileshc
@rathileshc 3 жыл бұрын
Really great tutorial , and could you please tell which theme are you using in VS CODE ? it looks like very nice ..
@jherr
@jherr 3 жыл бұрын
Night Wolf [black] and Operator Mono for the font.
@jr-hp7er
@jr-hp7er 3 жыл бұрын
You're awesome Jack 😘
@kettenbach
@kettenbach 3 жыл бұрын
Awesome content as usual Jack. Can I ask how you got that amazing prompt in your terminal. I would love to use that! Thanks and have a great week.
@jherr
@jherr 3 жыл бұрын
That's oh-my-posh + the powerlevel10k_rainbow theme + SpaceMono NF for the font.
@kettenbach
@kettenbach 3 жыл бұрын
@@jherr so for Mac? You're using PowerShell?
@jherr
@jherr 3 жыл бұрын
@@kettenbach On Mac I use zsh (oh-my-zsh) in iTerm2.
@maximgasai1349
@maximgasai1349 3 жыл бұрын
@@kettenbach nah, oh-my-posh works with macOS and Linux shells as well
@DarkShadow00972
@DarkShadow00972 Жыл бұрын
Hi jack u automatically getting lot of intellisense which extension r u using?
@jherr
@jherr Жыл бұрын
GitHub Copilot.
@DarkShadow00972
@DarkShadow00972 Жыл бұрын
@@jherr thanx 👍
@aminedaimallah310
@aminedaimallah310 3 жыл бұрын
nice tutorial, i just have a question, is this what it's called Serverless Components? i mean the last part of the video
@jherr
@jherr 3 жыл бұрын
Not that I know of. Serverless Components is interesting stuff though. I hadn't heard of it before.
@aminedaimallah310
@aminedaimallah310 3 жыл бұрын
@@jherr oh my bad it called React Server Components, i made a mistake haha
@jherr
@jherr 3 жыл бұрын
@@aminedaimallah310 No worries.
@jherr
@jherr 3 жыл бұрын
@@aminedaimallah310 React Server Components is actually something different. It's an optimization around server side rendering.
@aminedaimallah310
@aminedaimallah310 3 жыл бұрын
@@jherr oh i see, thanks for explaining, btw i like the place where you film the tutorials, is it a forest?
@fadi7819
@fadi7819 3 жыл бұрын
What is this font he is using in vs code ?
@jherr
@jherr 3 жыл бұрын
Operator Mono
@rjmunt
@rjmunt 3 жыл бұрын
I might need to rewatch but why rewired in one app and craco in the other?
@jherr
@jherr 3 жыл бұрын
Because some folks use craco, other folks use react-app-rewired, and this video covers both. :)
@rjmunt
@rjmunt 3 жыл бұрын
@@jherr Ahhh great thanks for covering all the bases sir. Great to see MF easily accessible in CRA at last.
@christopheanfry
@christopheanfry 2 жыл бұрын
Very Interesting video a lot of things to learn. I’m late with the comments but now that we see a lot of use of vite, is module federation still up to date and do you recommend it? I hear also about monorepo with nextjs is it working the same way? Thanks for your help and happy new year
@jherr
@jherr 2 жыл бұрын
There is a module federation plugin for vite but it is pretty early days yet. The monorepo + nextjs is great, but it only accomplishes build time sharing and not runtime sharing. That being said, most of the time build time sharing is fine. But when you need runtime sharing, Module Federation is a great option.
@christopheanfry
@christopheanfry 2 жыл бұрын
@@jherr thank you so much for your reply really appreciate. Will check the plug-in for vite.
@andersonluissilva8414
@andersonluissilva8414 3 жыл бұрын
You are amazing!
@yathink2406
@yathink2406 3 жыл бұрын
Can we reduce node modules for each directorory into one
@igor_cojocaru
@igor_cojocaru 3 жыл бұрын
Cool! Thank you
@Antoshkiv1
@Antoshkiv1 Жыл бұрын
Great video!
@khanhnam99
@khanhnam99 3 жыл бұрын
extension ? path show apple on visual studio code ?
@devmohamedkh
@devmohamedkh 3 жыл бұрын
@jherr
@jherr 3 жыл бұрын
It's in the description, but it's oh-my-posh with the powerlevel10k theme, with SpaceMono NF as the font. I also use iTerm 2 and oh-my-zsh. And I use iTerm as the terminal within VS Code.
@devmohamedkh
@devmohamedkh 3 жыл бұрын
@@jherr Can you tell me the name of the extension that completes the codes, please Like the one who completed the path shown in 10:30
@jherr
@jherr 3 жыл бұрын
@@devmohamedkh Well, that particular import is Path Intellisense marketplace.visualstudio.com/items?itemName=christian-kohler.path-intellisense But you probably want GitHub Copilot, which is doing a lot of the more TypeScript code-ey still hinting.
@devmohamedkh
@devmohamedkh 3 жыл бұрын
@@jherr thank you so much ❤
@maksymdudyk1718
@maksymdudyk1718 3 жыл бұрын
Thank you very much. Yet, it seems to me that your "setNames(makeUppeCase(module.default))... is not a common solution.
@jherr
@jherr 3 жыл бұрын
Yeah, I don't think I would allow that particular variant. But the point here was just to show how to use default vs named exports.
@kirillpavlovskii8342
@kirillpavlovskii8342 2 жыл бұрын
Great , thanks
@abhisheksharma9796
@abhisheksharma9796 3 жыл бұрын
How much for the cabin in the woods?
@jherr
@jherr 3 жыл бұрын
I think it's currently valued at $700K USD.
@ashish_prajapati_tr
@ashish_prajapati_tr 3 жыл бұрын
@@jherr it's so costly
@anasouardini
@anasouardini 2 жыл бұрын
do I need to do this when using Vite?
@jherr
@jherr 2 жыл бұрын
Not really, because Vite serves every module independently. But Vite isn't used for production. So you will want to make sure whatever production system you are using supports it.
@shinmessiah
@shinmessiah 3 жыл бұрын
I watched this video over 3 times or so. The content is really good and particularly useful for a project at work using external data stores. Super clear and useful! Actually, already using craco for some webpack => electron stuff, should be easy to drop in Also, I had to research what was going on with your terminal, with those nifty tags and such lol
@jherr
@jherr 3 жыл бұрын
If craco Module Federation works in Electron let me know. I'll probably give it a try, but not soon. So if you give it a go and get it going let me know.
@jvzaniolo
@jvzaniolo 3 жыл бұрын
Can you make a video about Remix?
@techhguy
@techhguy 3 жыл бұрын
Hey Joao, Here's the link to Jack's take on Remix => kzbin.info/www/bejne/qJi9nJdjh6aMnKc
@ytPEDROjoao
@ytPEDROjoao 11 ай бұрын
🤯
@waqasrana5734
@waqasrana5734 2 жыл бұрын
thanks
@vulcs
@vulcs 2 жыл бұрын
The problem are bundles, ESM solves this
@shreyasshahu1423
@shreyasshahu1423 3 ай бұрын
Respect++
@ahmedrapira7610
@ahmedrapira7610 2 жыл бұрын
thnx
@DuyTran-ss4lu
@DuyTran-ss4lu 2 жыл бұрын
great
@jaybhatt6775
@jaybhatt6775 2 жыл бұрын
God
@hasi90s
@hasi90s Жыл бұрын
Who the hell will add button for users to click that button and load the stuff , sorry to say but the start of your video is ridiculous and misleading you should be straightforward in teaching something and anyone searching for code splitting is not a starter of react he/she is searching for code splitting because he/she has developed app now optimizing it mind it
Mastering React Memo
26:56
Jack Herrington
Рет қаралды 138 М.
React Server Components: A Comprehensive Breakdown
52:42
Theo - t3․gg
Рет қаралды 107 М.
OCCUPIED #shortssprintbrasil
0:37
Natan por Aí
Рет қаралды 131 МЛН
Жездуха 41-серия
36:26
Million Show
Рет қаралды 5 МЛН
Ozoda - Alamlar (Official Video 2023)
6:22
Ozoda Official
Рет қаралды 10 МЛН
Mastering React's useEffect
25:20
Jack Herrington
Рет қаралды 177 М.
Mastering async code with Typescript and Javascript
39:01
Jack Herrington
Рет қаралды 78 М.
Mastering React Context: Do you NEED a state manager?
37:26
Jack Herrington
Рет қаралды 101 М.
Code Splitting in React JS - Lazy Loading Performance Optimization
16:10
Why Signals Are Better Than React Hooks
16:30
Web Dev Simplified
Рет қаралды 495 М.
You're Doing React Hooks Wrong, Probably
20:11
Jack Herrington
Рет қаралды 64 М.
Five Clever Hacks for React-Query and SWR
40:09
Jack Herrington
Рет қаралды 60 М.
"Simple Made Easy" - Rich Hickey (2011)
1:01:39
Strange Loop Conference
Рет қаралды 107 М.
NextJS 12.1 SSR & SSG: Everything you need to know
31:18
Jack Herrington
Рет қаралды 99 М.
OCCUPIED #shortssprintbrasil
0:37
Natan por Aí
Рет қаралды 131 МЛН