Asset loading in React

  Рет қаралды 1,971

Ryan Toronto

Ryan Toronto

Күн бұрын

Пікірлер: 23
@ashleyredman
@ashleyredman 8 ай бұрын
Absolute quality content, looking forward to React 19.
@RyanToronto
@RyanToronto 8 ай бұрын
Thanks! I can't wait for React 19
@xorlop
@xorlop 8 ай бұрын
Your excitement is contagious!
@RyanToronto
@RyanToronto 8 ай бұрын
Woohoo, thanks! :)
@thisweekinreact
@thisweekinreact 8 ай бұрын
Greatly explained! I thought maybe using a larger high-res image on the details page could be a cool demo too since we'd see the image appear after navigation and the transition could also fix it?
@RyanToronto
@RyanToronto 8 ай бұрын
Wow thank you! I'm a huge fan of this week in React! Yes an image component that suspends is a great idea! I think I can make that work, sounds like a great idea for my next video :)
@mryechkin
@mryechkin 8 ай бұрын
Great stuff! Clever way to show that loading spinner with "data-transitioning" too - I'll have to remember that :)
@RyanToronto
@RyanToronto 8 ай бұрын
Thanks Mykhaylo! That data-transitioning styling is a little trick Sam showed me. It's very handy!
@jitxhere
@jitxhere 8 ай бұрын
Thank you for awesome explanation. Easy clear and concise. I have also taken your buildui course. It was very helpful
@RyanToronto
@RyanToronto 8 ай бұрын
Thank you, that's great to hear! Are there topics on RSCs you'd like to see covered?
@RodrigoMallmann1
@RodrigoMallmann1 8 ай бұрын
one issue I dont know would happen is this onClick conflicting with the link. does it is able to still work as a link, opening in a new tab and such?
@RyanToronto
@RyanToronto 8 ай бұрын
Good question! It still functions as a link (can cmd click, open in new tab, etc). That's the reason we use , so all the normal behavior still works, but we can intercept the normal "clicks" with onClick to start a transition.
@xNReaperx
@xNReaperx 8 ай бұрын
Love your videos!
@LutherDePapier
@LutherDePapier 8 ай бұрын
Would you argue that "dynamic CSS stylesheets" like these are an example of something that couldn't be as efficiently achieved with Tailwind? I was to believe Tailwind would replace stylesheets altogether, but this seems to be a clear example where they would be preferrable.
@RyanToronto
@RyanToronto 8 ай бұрын
Great question! I think you could build these sorts of dynamic pages using Tailwind as well. It's really up to you!
@aaronvandenberg5863
@aaronvandenberg5863 8 ай бұрын
Really helpful vid! 👏
@RyanToronto
@RyanToronto 8 ай бұрын
Thanks!
@Ali-sc6dh
@Ali-sc6dh 8 ай бұрын
Actually wouldn't the stylesheet not unloading be a concern regardic tailwind css ? Eventhough it is atomic css, the order of css declaration will matter especially for media query styles. Wouldn't this break if for exemple you had a md:text-green in your previous css but then you load a new tailwind css stylesheet that only has text-red which will take priority regardless of the media query ?
@dealloc
@dealloc 8 ай бұрын
Yes it would be a problem. The solution is to serve your Tailwind CSS from a global CSS file. It's OK to do so, because Tailwind scales linearly as it doesn't contain duplicate CSS. This is the beauty of utility class names. Additionally that CSS can be cached by the browser. This means you avoid duplication and can ship only the necessary CSS for the given page through assets loading, resulting in less bandwidth and faster load times for the user. But rethink using asset loading at first, because it can negatively impact the user experience where it doesn't need to. This is not unique to Tailwind either, you should always try to keep your common CSS global, even if it may contain classes that are used a few places; as long as they are part of the overall design. Asset loading is only really necessary for specific cases where that additional CSS is used infrequently, or user customizable (the books example here is not such a good example IMO).
@Ali-sc6dh
@Ali-sc6dh 8 ай бұрын
@@dealloc Yeah great take, thanks for the tips !
@RyanToronto
@RyanToronto 8 ай бұрын
Good to know about tailwind's responsible styles needing a specific load order. And I agree, tailwind should be loaded once globally. Tailwind is not a good candidate for asset loading. Why is books not a good example? The CSS that's loaded through asset loading is only specific to that book and it's used infrequently... seems to meet of your criteria?
@dealloc
@dealloc 8 ай бұрын
@@RyanToronto You're right, it would be a good example at scale. I was too quick on the keys before thinking about the potential use-cases beyond a few books. My apologies.
@RyanToronto
@RyanToronto 8 ай бұрын
@@dealloc User specific/customized styles is a great example too, really like that idea
Handling RSC Errors in Next.js
9:16
Ryan Toronto
Рет қаралды 2,7 М.
React's new cache function
10:14
Ryan Toronto
Рет қаралды 10 М.
Motorbike Smashes Into Porsche! 😱
00:15
Caters Clips
Рет қаралды 23 МЛН
ТЫ В ДЕТСТВЕ КОГДА ВЫПАЛ ЗУБ😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 3,7 МЛН
Миллионер | 3 - серия
36:09
Million Show
Рет қаралды 1,1 МЛН
How I animate 3Blue1Brown | A Manim demo with Ben Sparks
53:41
3Blue1Brown
Рет қаралды 1 МЛН
Out-of-order streaming in React
11:02
Ryan Toronto
Рет қаралды 7 М.
HOW TO ADD IMAGES AND MAKE YOUR WEBSITE POP!
1:12:34
CodeWorks Instructors
Рет қаралды 10
Skeleton Loading in React Like a PRO!
9:41
Code Commerce
Рет қаралды 18 М.
Why I use Zod with Server Actions
15:21
Ryan Toronto
Рет қаралды 13 М.
They made React great again?
4:11
Fireship
Рет қаралды 1 МЛН
Preloading data (React's cache part 2)
10:09
Ryan Toronto
Рет қаралды 1,5 М.
Why you can't set cookies in Server Components
10:58
Ryan Toronto
Рет қаралды 10 М.
Motorbike Smashes Into Porsche! 😱
00:15
Caters Clips
Рет қаралды 23 МЛН