TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Next.js 2.0

627 pointsby tbassettoabout 8 years ago

32 comments

miguelollerabout 8 years ago
We recently used Next.js to build out an MVP. It was a pleasure to work with.<p>For those wondering what this is, it&#x27;s basically a slightly more opinionated Create React App [1].<p>Here are some of the benefits:<p>- No need to setup complicated tooling<p>- Server and client (SPA-style) rendering out of the box<p>- Filesystem for routing using the `pages` directory<p>- `getInitialProps` component lifecycle to encapsulate data requirements per component<p>- Automatic code splitting for each route<p>- If it works with React, it works with Next.js<p>Here are some of the issues we encountered:<p>- Importing non-JS files from `node_modules` (like normalize.css) was not as simple as it could be (#1245 [2])<p>- Animation transition between pages is still being worked on (#88 [3])<p>- There are still some inconsistencies between server and client that could improve, like running Webpack on the server (#1245 [2])<p>- Doing proper scroll restoration when routing (#1309 [4])<p>We will continue to use it as long as it keeps letting us move fast without having to worry about spending hours setting up React tooling.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;facebookincubator&#x2F;create-react-app" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;facebookincubator&#x2F;create-react-app</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;zeit&#x2F;next.js&#x2F;issues&#x2F;1245" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;zeit&#x2F;next.js&#x2F;issues&#x2F;1245</a><p>[3] <a href="https:&#x2F;&#x2F;github.com&#x2F;zeit&#x2F;next.js&#x2F;issues&#x2F;88" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;zeit&#x2F;next.js&#x2F;issues&#x2F;88</a><p>[4] <a href="https:&#x2F;&#x2F;github.com&#x2F;zeit&#x2F;next.js&#x2F;issues&#x2F;1309" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;zeit&#x2F;next.js&#x2F;issues&#x2F;1309</a>
评论 #13970340 未加载
评论 #13971191 未加载
评论 #13968853 未加载
jonkneeabout 8 years ago
This page has some huge issues loading resources. I kept it open as a tab to dive into later and noticed it was still spinning after a long time... I refreshed with Developer Tools open and after 2 minutes over 100MB had been transferred!<p>It appears the screencast video is to blame, it is not only huge (~70MB), but it keeps getting downloaded instead of just replaying. I just checked the console again and the page is now up over 300MB downloaded. Glad I wasn&#x27;t on mobile data!<p>Update: I downloaded the video and ran it through ffmpeg to see how much space could be saved... Original size 72.2MB, new size 1.7MB. Screencasts obviously compress very well, but this was pretty surprising. You could easily optimize this down further and probably half the size yet again.<p><pre><code> ffmpeg -i hello-world_2.mp4 -vcodec libx264 -preset veryfast smaller.mp4</code></pre>
评论 #13971934 未加载
评论 #13970550 未加载
评论 #13970025 未加载
评论 #13971423 未加载
评论 #13970352 未加载
评论 #13969602 未加载
评论 #13970493 未加载
Stamyabout 8 years ago
Vue.js ecosystem has alternative as well. It is Nuxt.js (<a href="https:&#x2F;&#x2F;nuxtjs.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;nuxtjs.org&#x2F;</a>)
评论 #13970614 未加载
评论 #13971075 未加载
评论 #13974546 未加载
ndreckshageabout 8 years ago
Next is great. I would love to deprecate my SSR starter kit - Sambell - <a href="https:&#x2F;&#x2F;github.com&#x2F;humblespark&#x2F;sambell" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;humblespark&#x2F;sambell</a> - once it supports a layout file, for animated transitions, etc. Right now, React Router seems fundamentally more powerful as a SPA framework.
评论 #13970429 未加载
smdzabout 8 years ago
I don&#x27;t understand why people here are comparing Next.js to create-react-app.<p>I see Next.js primarily focusing on server-rendered React and then it also supports client-rendering. I see create-react-app is primarily focused on client-javascript. Am I missing something?
评论 #13968863 未加载
评论 #13968712 未加载
评论 #13968713 未加载
tabethabout 8 years ago
Ah, so close.<p>I really just want something like Handlebars, with a generic adapter for any language for compilation.<p>Then you can load with javascript a client-side controller if you want to add in interactivity.<p>---<p>To expand, I think the idea solution would be the following:<p>1. Server side view, let&#x27;s call it &quot;Bars&quot;<p>2. Bars can be written on the front-end or back-end, does&#x27;t matter. It&#x27;ll compile to BarsHTML.<p>3. If you write Bars on the back-end, then when you serve your page it&#x27;ll compile Bars into BarsHTML.<p>3a. If you want to sprinkle JS onto Bars, you&#x27;ll use BarsControllerJS, an adapter to whatever framework of your choice, to manipulate it. The main difference between this and manipulating the DOM is that the interface to do this is not DOM centric.<p>4. If you write Bars on the front-end, it&#x27;s the same as (3), but you get (3a). If you decide you&#x27;d rather do server side rendering, you literally just move your views to the server. The controller is already abstracted, so you wouldn&#x27;t need to do anything else.
评论 #13971549 未加载
评论 #13969274 未加载
评论 #13968458 未加载
评论 #13967658 未加载
anupshindeabout 8 years ago
It would be great to see TypeScript support with NextJS out of the box. It can be done with some work today.<p>Inspired by an earlier(probably first release) of NextJS, I had attempted TypeScript and server-rendered react here:<p><a href="http:&#x2F;&#x2F;www.anupshinde.com&#x2F;posts&#x2F;react-typescript-server-render&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.anupshinde.com&#x2F;posts&#x2F;react-typescript-server-rend...</a>
评论 #13972835 未加载
egeozcanabout 8 years ago
I wonder how hard it would be to programatically cache a Next.js app with a ServiceWorker to make it also work offline. I guess one could copy the logic from the prefetch script as it makes network requests like this: <a href="http:&#x2F;&#x2F;i.imgur.com&#x2F;c3H176u.png" rel="nofollow">http:&#x2F;&#x2F;i.imgur.com&#x2F;c3H176u.png</a>
jorjordandanabout 8 years ago
The link is wrong for the Koa server example. It points to the Hapi example, it should point here: <a href="https:&#x2F;&#x2F;github.com&#x2F;zeit&#x2F;next.js&#x2F;tree&#x2F;master&#x2F;examples&#x2F;custom-server-koa" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;zeit&#x2F;next.js&#x2F;tree&#x2F;master&#x2F;examples&#x2F;custom-...</a>
zackifyabout 8 years ago
If anyone wants to see, we are using next.js 2.0 on <a href="https:&#x2F;&#x2F;kimmel.com" rel="nofollow">https:&#x2F;&#x2F;kimmel.com</a>. Yes, the designer added way too many fonts, but overall it&#x27;s a really nice static site thanks to next and the programmatic api allowed me to generate blog post pages!
jakobloekkeabout 8 years ago
I&#x27;m curious: Where do these anti-React (anti-spa?) people come from, technologically? Rails? Php? Some .Net stack? Do you think the web Peaked with Perl-based CGI-scripts? I&#x27;ve been in this game for many years, and to me, any technology that speeds up development cycle time is an improvement. There&#x27;s a reason React is so popular.
评论 #13967710 未加载
评论 #13967155 未加载
评论 #13967135 未加载
评论 #13967269 未加载
评论 #13967366 未加载
评论 #13967498 未加载
评论 #13968094 未加载
评论 #13967615 未加载
评论 #13967232 未加载
评论 #13967429 未加载
评论 #13967133 未加载
评论 #13967298 未加载
评论 #13972705 未加载
评论 #13970122 未加载
评论 #13970136 未加载
评论 #13967575 未加载
评论 #13967404 未加载
beezischillinabout 8 years ago
Awesome stuff. Just a quick question that doesn&#x27;t click with me: how would you use Redux to manage application state for multiple users, server-side? If someone could drop me some examples or articles on this, I&#x27;d be really thankful!
评论 #13970105 未加载
mike-cardwellabout 8 years ago
I rebuilt <a href="https:&#x2F;&#x2F;www.emailprivacytester.com" rel="nofollow">https:&#x2F;&#x2F;www.emailprivacytester.com</a> in NextJS v1 - <a href="https:&#x2F;&#x2F;gitlab.com&#x2F;mikecardwell&#x2F;ept3&#x2F;tree&#x2F;master" rel="nofollow">https:&#x2F;&#x2F;gitlab.com&#x2F;mikecardwell&#x2F;ept3&#x2F;tree&#x2F;master</a> - Was a pleasure to use. My main problem though was that I couldn&#x27;t add custom routes for API end-points, so had to split the application into a frontend (in Next) and backend express app. Looks like v2 fixes this. I will definitely be updating to take advantage.
sergiotapiaabout 8 years ago
Next looks very interesting and feels very much like the PHP of old where stuff just works with sane defaults. Very cool stuff.<p>My one criticism of this is: Component CSS is cancer. I&#x27;ve worked on a large scale javascript project and it was riddled with duplicated CSS in every component, all in the name of being conflict-free.<p>You know what I call that? Not knowing how to scope your styles properly with something like BEM. <a href="http:&#x2F;&#x2F;getbem.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;getbem.com&#x2F;</a>
评论 #13967062 未加载
评论 #13967935 未加载
评论 #13968206 未加载
andrewgleaveabout 8 years ago
The MP4 included in the page causes graphics corruption and locks my MBP in Safari 10.1. Anyone else seeing this?<p>Save your work before trying, though.
TeeWEEabout 8 years ago
Looks cool. But everybody who thinks of building a webapp, try todo it without react if you don&#x27;t need it. For example <a href="https:&#x2F;&#x2F;next-news.now.sh&#x2F;" rel="nofollow">https:&#x2F;&#x2F;next-news.now.sh&#x2F;</a> is MUCH MUCH slower than normal hacker news. And its also much more difficult to maintain, and less future proof.<p>Greetings
评论 #13980935 未加载
EGregabout 8 years ago
Not to toot our own horn, but I wanted remark on how similar the issues we have had to deal with in our own framework (<a href="https:&#x2F;&#x2F;qbix.com&#x2F;platform" rel="nofollow">https:&#x2F;&#x2F;qbix.com&#x2F;platform</a>), since 2011.<p>When we built it, we had out of the box:<p>+ Tools (our name for components)<p>+ Pages (to support all web standards)<p>You place tools on pages, the framework does the rest:<p>+ It loads JS and CSS on demand<p>+ It adds&#x2F;removes tools from pages automatically as you navigate<p>+ Support for web standards, HTML5 history w fallbacks, etc.<p>+ Tools can contain other tools<p>+ You have events for when all parent tools have activated (onActivate) and when all child tools activated (onInit)<p>+ JS and CSS had to be namespaced by convention from day 1, by module and tool name.<p>We use events instead of virtual DOM. We didn&#x27;t use fancy JSX or preprocessors to do it. It&#x27;s all written in ES4 JS and runs on every modern browser and IE8.<p>But the problems are very similar in scope.
评论 #13969161 未加载
hoodoofabout 8 years ago
&gt;&gt; &quot;More than 3.1 million developers read our announcement post of Next.js. &quot;<p>Really? 3.1 million developers? I&#x27;m not saying I don&#x27;t believe, but wow, how?<p>edit: actually I am saying either I don&#x27;t believe or you&#x27;ve miscalculated somehow.
评论 #13970725 未加载
xutopiaabout 8 years ago
There is something I do not understand. Why does `&lt;div&gt;` not create a syntax error in the Javascript examples? Is there a pre-processor?
评论 #13967389 未加载
评论 #13967236 未加载
评论 #13967239 未加载
评论 #13967262 未加载
mmgutzabout 8 years ago
If I&#x27;m understanding correctly, seems like this is back to the old days when routes mapped directly to pages. From experience with ASP, it is not a good thing. You need to separate the routing from the presentation ala MVC. I can see the benefit if next.js is intended to be create-react-app++.
fourstarabout 8 years ago
I want to use this but I&#x27;m hesitant to do so for a project that&#x27;s backed specifically by a single company<i>. Can someone help alleviate my concerns?<p></i> I had to verify my email address and accept the TOS before I could use their command line tool.
评论 #13969405 未加载
asadlionpkabout 8 years ago
I have recently migrated my boilerplate code to Next.js and it&#x27;s awesome to work in. Previously I had my own code-splitted&#x2F;server-side rendering setup but next does it better!
swlkrabout 8 years ago
I used next on a side project, zero boilerplate is refreshing.
n3bsabout 8 years ago
How does this compare to react-boilerplate? I&#x27;ve been using react-boilerplate recently and it&#x27;s been solid so far.
评论 #13974488 未加载
kbodyabout 8 years ago
I would love and use this if it was using Riot instead of React.
tonethemanabout 8 years ago
Frameworks made of frameworks... frameworks all the way down
评论 #13967074 未加载
评论 #13967538 未加载
评论 #13967192 未加载
tambourine_manabout 8 years ago
I guess I became way too cynical.<p>I though it was a satire, based on its name. Maybe there is some hidden self deprecating joke that went over my head, but Next + JS + 2.0 seemed too buzzwordy to be true.<p>The tech looks interesting. Still looks to me like a lot of stuff that I don&#x27;t understand why I would need, but that&#x27;s an old rant I have with the curent js ecosystem.
geniiumabout 8 years ago
Very promising!
Polarityabout 8 years ago
nice, thx!
vincivinceabout 8 years ago
Nice work.
ergo14about 8 years ago
Why in the world everything needs to be made with react that makes it incompatible&#x2F;hard to integrate with any other frameworks?
评论 #13966849 未加载
评论 #13967048 未加载
grumblestumbleabout 8 years ago
i know this is a tangent and not directly related to next.js, but the react ecosystem&#x27;s insistence on coming up with increasingly convoluted and self-defeating stories around how to handle CSS instead of just using the tool the way it&#x27;s intended is pure insanity. the emphasis with styled-jsx favors encapsulation with no real thought put into external overrides or customization, which makes this a non-starter for creating vendor components that are actually usable. compare <a href="https:&#x2F;&#x2F;github.com&#x2F;zeit&#x2F;styled-jsx" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;zeit&#x2F;styled-jsx</a>, which can only euphemistically be called a naive implementation, with the documentation around custom properties, with the styling documentation at <a href="https:&#x2F;&#x2F;developers.google.com&#x2F;web&#x2F;fundamentals&#x2F;getting-started&#x2F;primers&#x2F;shadowdom" rel="nofollow">https:&#x2F;&#x2F;developers.google.com&#x2F;web&#x2F;fundamentals&#x2F;getting-start...</a>.