Lurker News

Comments (209) 32 threads

Earlier comments
Rauchg1 reply#
One of the authors of Next.js here. I want to clarify that all the points against Next.js are virtues! They probably just arise from Rich not being so familiar with it (or not having looked at the examples/ directory extensively: https://github.com/zeit/next.js/tree/canary/examples)

1. I think this point is trying to say that we don't have special "mask files" inside `pages/`, which is an idea worth exploring. Right now, Next.js instead gives you full flexibility on how you want to match the routes on your server (as it should be). For example, `your-domain.com/xyz` can even first perform a database query before deciding what page to render it with (if any).
2. What the author points out as a weakness here is that you can handle server things directly in your server code (`server.js` using micro or express for example). That sounds like the right thing to do to me, and if you don't want that, you still can do something like:

  // pages/my-server-page-only.js
  export default ({ req, res }) => res.end('hi')
3. "To use the client-side router, links can't be standard tags." This is by design. Magically overloading `` to add client-specific behavior sounds like the days of jQuery or TurboLinks. If you want client-side behavior, wrap `` in the higher-order `` component. There also very important properties of the `` like `` that are simply not part of the `` standard definition.

Also noteworthy: the entire ZEIT Documentation is written in Markdown with React components. It's open source: https://github.com/zeit/docs
On size: the Next.js and React teams are both working towards really interesting solutions to ship only the code that's necessary, without resorting to templating as the main strategy. Our team actually spends more time on the 'compiler' parts of Next.js than the 'framework API' parts. (the API has barely changed since the initial 0.1 release in fact).
Additionally, since Next.js uses React as peer dependencies, you'll also get to do `yarn add next react react-dom-lite` https://github.com/jquense/react-dom-lite in the future.
Overall, I think Sapper is an excellent framework for Svelte users. I'm looking forward to seeing more Next.js-like frameworks.
For Vue users: check out https://nuxtjs.org/!

rich_harris1 reply#
Thanks Guillermo. I hope the respect and appreciation I have for the Next team came across in the post.

My criticisms aren't based on misunderstandings, however. Route masking provides flexibility but it really does undermine the ability to navigate a complex app structure — Nuxt.js evidently reached the same conclusion, because they too have dynamic route parameters encoded in filenames.
The my-server-page-only.js results in a 'Cannot read property 'end' of undefined' error for me, because it seems Next can't distinguish between universal and server-only routes. If you have any examples of this working, please do share them!
The Markdown ZEIT documentation is cool, but doesn't really address the problem I was getting at with , which is that your content is likely to come from a database. (Incidentally, Sapper does provide support for , which works exactly the same as .)
> On size: the Next.js and React teams are both working towards really interesting solutions to ship only the code that's necessary, without resorting to templating as the main strategy.
I'm excited to see where that takes us. My conviction remains that templates will always provide more and deeper optimisation possibilities than JSX, but this is a competition in which ultimately we're all winners.

tribby#
> Nuxt.js evidently reached the same conclusion, because they too have dynamic route parameters encoded in filenames.

nuxt.js applications don't need to rely on filenames for routing. there's a handy nuxt module for this -- https://github.com/nuxt-community/router-module

young_greedo1 reply#
ITT: a complete misunderstanding of how a universal JS web app works.
thomasfromcdnjs#
Agreed. As a JS app developer I now feel more confident about my job security.
techaddict009#
Why dont you guys use laravel when you need better SEO and server side rendering? It is fast, easy to learn, easy to deploy, etc.
nwmcsween1 reply#
Could webpack be replaced with something else? IMO webpack is a giant mess.
arxpoetica#
Have you had a look at Rollup.js (incidentally by the author of Sapper).

Load more comments