4 ms·
> This is nice enough. But the point is: it requires JavaScript (React, 3rd-party-tooltip-on-npm, your JS code) before anything will render in the browser. It’s
by codethief 3y ago
> This is nice enough. But the point is: it requires JavaScript (React, 3rd-party-tooltip-on-npm, your JS code) before anything will render in the browser. It’s an all-or-nothing approach.
As was already pointed out in the previous discussion (of the previous blog post) here on HN, this is a complete non-issue. In most frameworks these days you would prerender your application or maybe even server-side render it.
The issue I see with the suggested "solution" (of the non-issue) is that the "placeholder" <img> tag is not "type-safe". I can put anything in there without paying attention to what exactly my web component does or expects. If the behavior of my web component changes, I won't get a warning at code writing or compile time. Instead the layout will silently break.
All in all, I don't think this approach scales well with the size of the code base and the number of people working on it. (Let's say, e.g., <user-avatar> is provided by some other team.) And again, it's trying to solve a non-issue.
- throwaway318 3y agoIf <user-avatar> starts to provide something else, and depends on compiling a code base to alert that it's breaking something, an automated test(?), then that suggests everyone's working blind and hoping for the best while the application development methodology's broken.
- codethief 3y agoHave you ever worked on (or with) a component library for a large code base? When updating the library you can't possibly manually check every single usage of every component. I mean, depending on the CSS, things might already break if the <img> suddenly needs to be wrapped inside a div etc.
- quickthrower2 3y agoI agree although prerender land has it’s issues. Mainly it is hard to make forms that work both with/without JS, especially with validation. You need separate code paths for both. At least in NextJS. The latest version is very close though. Sans validation and with experimental features I think you can have a server action that handles both form and JS submissions the same way.