umma.dev

Next.js 15

A few points taken from the Next.js15 RC blog post. To be followed up once everything becomes more stable in the world of React.

React Complier

// next.config.ts
const nextConfig = {
  experimental: {
    reactCompiler: true,
  },
};

module.exports = nextConfig;

next/after

after() is a new experimental API by allowing you to schedule work to be processed after the response has finished streaming, this means secondary tasks can run without blocking the actual response.

// next.config.ts
const nextConfig = {
  experimental: {
    after: true,
  },
};

module.exports = nextConfig;
import { unstable_after as after } from "next/server";
import { log } from "@/app/utils";

export default function Layout({ children }) {
  // Secondary task
  after(() => {
    log();
  });

  // Primary task
  return <>{children}</>;
}