Re:Zero-Bundle-Size React Server Components
by Nkuna on Monday December 21, 2020 @03:31PM
(#25499214)
Next¹ offers a more fleshed out framework with far less boilerplate for both client and server code.
Server side, Nest² offers much of the same. Think Angular but for backend dev. Yes, it has some boilerplate to it but for the most part, its CLI eases redundant typing.
Re:Zero-Bundle-Size React Server Components
by slow_donkey on Monday December 21, 2020 @11:44PM
(#25502940)
You can be productive with Nest.js but I'd hate to promote it as a great solution. It's really a mashup of other JS libs with Nest bringing a rather convoluted form of dependency injection and http action decorators. You can build your own soup rather easily without the Nest overhead and with better choices. It's not the worst place to start, there's just better shit out there.
Re:Zero-Bundle-Size React Server Components
by hermitwriter on Monday December 21, 2020 @05:41PM
(#25500552)
I don't know. I use next.js and love it. But I have to implement two static methods for every thing I want to fetch... This also locks me into next.js...
Re:Zero-Bundle-Size React Server Components
by eyelidlessness on Monday December 21, 2020 @06:27PM
(#25500996)
I’ve shopped around a lot and most projects targeting a similar featureset are generally adopting the Next.js APIs for server-side data fetching. So it’s probably not as bad in terms of lock-in as you’d expect.
Re:Zero-Bundle-Size React Server Components
by xeon06 on Monday December 21, 2020 @11:50PM
(#25502977)
I think more people should take a look at https://blitzjs.com. It makes your lock in problem slightly worse I suppose but only because it argues that you want most apps to be coupled like this in real life. In exchange, it gives you great developer experience around things like data fetching.
Re:Zero-Bundle-Size React Server Components
by scsilver on Tuesday December 22, 2020 @04:10AM
(#25504416)
Touched this about a half a year ago. Feels like rails for react. Very opinionated and interesting how prisma is used to set up the data schema.
Re:Zero-Bundle-Size React Server Components
by acemarke on Monday December 21, 2020 @03:15PM
(#25499042)
That's exactly what Next.js is:
(as well as a few other tools in the ecosystem)
Re:Zero-Bundle-Size React Server Components
by arcturus17 on Monday December 21, 2020 @03:55PM
(#25499433)
Wait, Next.js would be useful for pure client SPAs? I built a prototype for the SSR and loved it, but it didn’t occur to me it could be used for client apps too...
Does it need to be served from a Node.js environment or can it be used as a bundler and be served from other servers (eg Django or Rails)?
Re:Zero-Bundle-Size React Server Components
by dbbk on Tuesday December 22, 2020 @07:42AM
(#25505686)
If you're building a dashboard-like SPA it's not really suitable, because every page is its own component, so you can't do nested layouts or routing.
Re:Zero-Bundle-Size React Server Components
by httgp on Tuesday December 22, 2020 @10:17AM
(#25506993)
You actually can build nested layouts in Next.js — see https://adamwathan.me/2019/10/17/persistent-layout-patterns-...
Re:Zero-Bundle-Size React Server Components
by chrisco255 on Monday December 21, 2020 @05:03PM
(#25500157)
Next.js can output static pages now on build time, so you don't necessarily need to use SSR unless you're hydrating data on the server.
Re:Zero-Bundle-Size React Server Components
by eatonphil on Monday December 21, 2020 @03:28PM
(#25499185)
Thanks! Somehow I thought next.js was only for SSR.
What are the other tools?
Re:Zero-Bundle-Size React Server Components
by chrisco255 on Monday December 21, 2020 @05:04PM
(#25500170)
Gatsby: https://www.gatsbyjs.com/
Re:Zero-Bundle-Size React Server Components
by danabramov on Monday December 21, 2020 @03:29PM
(#25499189)
Totally agree. The goal here is to give better building blocks for frameworks to build upon.
Re:Zero-Bundle-Size React Server Components
by mekkkkkk on Monday December 21, 2020 @05:40PM
(#25500545)
AFAIK an explicit goal of React (at least in the beginning) was to not be opinionated at all and to only provide the view/rendering part of an app. Since then it feels like its scope has expanded a bit. Or maybe not? Not sure which batteries are supposed to be included anymore. Would be interesting to hear Dan's thoughts on this.
Re:Zero-Bundle-Size React Server Components
by zaiste on Monday December 21, 2020 @03:39PM
(#25499288)
There's also Kretes¹ that comes with a React.js template. It pre-configures few popular libraries such as React Query, React Hook Form, built-in REST & GraphQL API, authorization/authentication, etc - so you can (relatively) quickly create a «full-stack» (TypeScript) app
[1]: https://kretes.dev
Re:Zero-Bundle-Size React Server Components
by xeon06 on Monday December 21, 2020 @11:51PM
(#25502979)
Take a look at https://blitzjs.com! It's built on top of Next.js, which everyone else has been recommending to you, but goes a step further that I think you might find enjoyable, reading your comment.
Maybe I've just been out of the loop. At work every React app I've built had all this custom logic for each of those pieces. But when I start a new project I'm loathe to do all that setup again.
I'd just like an opinionated framework built on React that gets rid of some of this boilerplate of browser routing, auth, api access, etc.
This isn't a knock on React. React is awesome. But at this point it's almost too barebones on its own.