Menu

React, etc. Tech Stack

React, Flux, GraphQL, Hack, HHVM...? All of this and more!

After.js, an alternative take on Next.js

In 2018 there seems to be lack of Universal JavaScript frameworks. Kicking off with Sapper, the old guard of Next.js and Nuxt.js now have a new alternative in After.js. The project shamelessly admits that it's heavily inspired by Next and uses parts of Razzle as it's building blocks.

Universal JavaScript frameworks execute the same code on both client and server environments, leading to both high first load performance as well as SEO and a seamless transition to a fluent Single Page App (SPA) user experience. The popularity of such tools is growing with such like Docker Inc using Next.js in production.

After.js comes from seasoned React developer Jared Palmer‏, also the brains behind Razzle, who was impressed by Next.js overall, but frustrated by some of it's architectural choices. His main gripe was with it's homegrown routing system, which is not the de-facto standard React Router 4.

In addition to giving credit to the brilliance of the simplicity of the concepts behind Next.js, such as the getInitialProps method. But the After.js dismisses the idea of relying on the file system as an API, which is one of the core concepts of Next borrowed from PHP development.

In addition to taking ideas and the routing component off-the-shelf, After.js also is using a fork of Razzle to provide it's universal capabilities. Razzle is a decoupled SSR toolkit that works across frameworks:

This makes Razzle independent of the underlying libraries and frameworks. So in addition to React.js from Facebook, Razzle's promise is that it works with Elm, Vue, Angular and virtually any future JavaScript UI technologies that keep popping up.
- Razzle enables Universal JavaScript apps decoupled from frameworks and libraries

There are some other goals than using React Router for the project, such as TypeScript being a first class citizen as well as generous overriding capabilities. This makes After.js a viable option for a starting point for the tinkerer audience who are not keen on taking an opinionated framework, but rather having a system designed with decoupled swappable components.

After.js is MIT licensed, compatible with the current React licensing and the source code and documentation is available on GitHub: https://github.com/jaredpalmer/after.js

UPDATE: Next.js will adopt React Router in a future release

Written by Jorgé on Tuesday January 16, 2018

Permalink - Tag: nextjs

« PostGraphile creates a GraphQL API from a PostgreSQL schema - Next.js to adopt React Router »