React offers a model in which the render function returns the UI representation based on data available at that point in time. But Next's developers said that this wasn't sufficient because it lacked a component lifecycle. "Lifecycle hooks allow us to handle the continuation of some rendering that originated on the server," the developers said. "You can start with a static representation of data, subscribe to real-time updates from a server and change it over time, for example. Or perhaps it just remains static." Next.js, they said, was their take on how to bring this vision forward.
React.component. With this approach, the system remains compose-able and testable.
For performance, Next.js tries to bring the best of the "fully server-rendered" and "single-page app, nothing server-rendered" realms. "For www.zeit.co, we've implemented a technique on top of Next.js that brings us the best of both worlds: every single
<Link /> tag pre-fetches the component's JSON representation on the background, via a ServiceWorker. " Also featured is CSS-in-JS using the glamor library, providing CSS capabilities without the need for parsing and compilation. With Next.js, large teams can collaborate on components with varying business and technical requirements as well.
Future plans for Next.js call for support for pluggable renderers, better JSX, and custom Babel and webpack configuration.
Sign up for CIO Asia eNewsletters.