Intermediate React, v2 Code Splitting Review and Q&A
This course has been updated! We now recommend you take the Intermediate React, v5 course.
Transcript from the "Code Splitting Review and Q&A" Lesson
>> Speaker 2: Does it just bubble up to the nearest suspense?
>> Brian Holt: Mm-hm, so if you had one above that, it would hit the first closest one, yeah.
>> Brian Holt: And I think it just crashes if you don't have one, I'm not sure.
>> Brian Holt: So Facebook says that they're using suspense everywhere.
>> Speaker 3: Is there anything different about using this with Parcel versus Webpack?
>> Brian Holt: Nope, they work the same way. Yeah, so they both look for this import keyword,
>> Brian Holt: And they'll split intelligently on that point and they both know how to do it. Maybe mechanically it works a little bit differently, but lazy comes from React and so lazy knows how to handle it.
>> Brian Holt: Same with rollup as well. So that's code splitting. There's not a lot more to it than that. It's a fairly easy technique, especially with lazy now, lazy and suspense. If you watch V1 and V2 of this course, this used to be a lot more difficult to do.
[00:01:06] [LAUGH] And it's just getting easier, which is cool.
>> Brian Holt: Okay, so that's the end of code splitting. So I'm gonna go reset my repo really quick.
>> Brian Holt: I'll do that in here, rather.
>> Brian Holt: So I'm gonna say git reset HEAD --hard, and then I'm gonna say git clean -f.
[00:01:38] And then I'm gonna say npm install. Again, if you want to check that out, the branch of that that's available is called code splitting and it is on the GitHub repo.