Hacker News new | ask | show | jobs
by onion2k 1098 days ago
Library support is pretty lousy.

Next 13's app directory and React Server Components is killing library support in React, so that's not such a big problem.

2 comments

I don’t know much about the former, but it’s not clear why React server components are going to kill library support.
Pretty much every library I have tried to use with Next App Router (and therefore RSC) doesn’t work with RSC. I’m sure it will change but we’ll be sticking for Next Pages for a while yet.
I think you may have missed that you can circumvent all of this by declaring your components to be client components.
What's the point of using RSC if you have to mark everything as client components?

At best you're getting SSR support since client components actually run on the sever as well, but there are already cleaner solutions for SSR react components that rehydrate in the browser.

You're not using RSC if you're marking everything as a client component. The point is that you can do that and continue to use your old components while also able to use the new app router infrastructure.
Is there that much benefit to just the file structure and router?

That feels like a ton of refactoring just to have the same and result for a user, but maybe I'm missing some important gains of the app directory.

What does that mean?
It means that library maintainers are having to make changes to their libraries to get them to work on the serverside, and a lot of them aren't not really doing that very quickly.Consequently moving to RSC reduces the number of libraries that work with your React code.

It's a short term problem because most popular libraries will get updated eventually, but some won't and they'll only ever work on the client side.

In the case of Next, maintainers need to package their libraries differently to support ESM modules, or you need to configure your project to use the experimental.esmModules=false flag. Again, it's not a particularly big problem but it does reduce the size of the available ecosystem a bit.

Before, there was only client-side. Server-side is opt-in. So all the libraries you used client-side, you can still use client-side by using client-side components
But that doesn’t mean React will /break/ existing libraries? It’s just a new feature that they need to start supporting, as you described.