Exploring Next.js 13.4: Stable Release of App Router and Future of Server-rendered React Apps

In this post, we take a deep dive into the latest foundational release of Next.js, a game-changing framework for server-rendered React applications. We will discuss the highlights of the new 13.4 version, with particular focus on the stability of the App Router feature.

Table of Contents

Introduction

Next.js, since its inception in 2016, has been providing a seamless way to server-render React applications, with the overarching objective of creating a dynamic, personalized, and global web. With the release of 13.4, the App Router is now deemed stable and ready to be adopted in production environments.

To install the latest version, use the following commands:

npm i next@latest react@latest react-dom@latest eslint-config-next@latest

The Birth of Next.js

Next.js was envisioned to facilitate server-rendered React applications employing a few key design principles:

  • Zero setup with the file-system as an API.
  • Everything is a function with only JavaScript required.
  • Automatic server rendering and code splitting.
  • Freedom to developers regarding data fetching.

After six years, a significant upgrade to the framework has been put forward to better achieve these design principles.

Streams and Routers

Since inception, the file-system based routing in Next.js has been a unique and user-friendly feature:

// Pages Router
import React from 'react';
export default () => <h1>About us</h1>;

This approach led to requests for enhanced support for layouts and flexibility in defining loading and error states. However, this was not easy to implement, given the existing router’s design.

Building a new version of the router was essential to cater to these needs and make the router compatible with streaming.

The Evolution of App Router

With the old Pages Router, layouts could not be composed, and data fetching could not be collocated with the component. However, with the new App Router, these limitations have been overcome:

// New: App Router ✨
// The root layout is shared for the entire application
export default function RootLayout({ children }) {
    return (
        <html lang="en">
            <body>{children}</body>
        </html>
    );
}
// Layouts can be nested and composed
export default function DashboardLayout({ children }) {
    return (
        <section>
            <h1>Dashboard</h1>
            {children}
        </section>
    );
}

Introducing Server Actions

The new feature, Server Actions, enables powerful server-first data mutations, reducing client-side JavaScript, and progressively enhanced forms. It allows seamless interaction with the rest of the data lifecycle, including the Next.js Cache, Incremental Static Regeneration (ISR), and the client router.

import db from './db';
import { revalidateTag } from 'next/cache';
async function update(formData: FormData) {
    'use server';
    await db.post.update({
        title: formData.get('title'),
    });
    revalidateTag('posts');
}

The Future of Next.js

With marking the App Router as stable, Next.js has reached a significant milestone, post rigorous internal testing, and validation from many early adopters. And while further optimizations are in the pipeline, this milestone marks the path for clarity for where developers should start learning and building applications today.

Please note: The new features can be adopted on a per-route basis. Hence, you don’t need to migrate all your pages/ to app/ at once.

Next.js has always aimed to create more user-friendly, dynamic and cutting-edge applications on top of the React architecture. With the success of Server Components and App Router, we believe we’re moving in the right direction.


Tags: #Next.js, #React, #App Router, #Server-Rendering
Reference Link

The Future of Bard: Unlocking a World of Possibilities

Introduction

With the latest updates to Bard, the possibilities are endless! We are thrilled to announce the expansion of Bard’s availability to over 180 countries and territories, including Japan and Korea. In addition, Bard is now equipped with image capabilities, coding features, and seamless app integration. In this blog post, we will dive into the details of these exciting new updates and explore the future of Bard as a truly global, visual, and integrated AI tool.

More Global Reach

Expanding Bard’s availability has been a top priority for us. We believe in democratizing access to AI technology, and by bringing Bard to more countries and territories, we can empower individuals from diverse backgrounds to harness the power of generative AI. Whether you’re in Japan, Korea, or anywhere around the world, Bard is now within your reach.

Enhanced Visual Experience

Visual communication is a vital aspect of human interaction, and Bard is evolving to accommodate this need. Users can now include images in their prompts, making the conversations with Bard more engaging and expressive. By simply using the format “, where alt serves as the title of the image, you can seamlessly incorporate visuals into your interaction with Bard.

But that’s not all! We’re integrating the power of Google Lens into Bard, allowing users to upload photos and receive creative captions within seconds. Imagine the convenience of having Bard generate captions for your personal photos or even professional visual content. The combination of Bard’s generative AI capabilities and the visual world captured by Google Lens will revolutionize how we interact and communicate with AI.

Coding Upgrades for Developers

Developers, rejoice! We’ve got some exciting enhancements tailored specifically for you. We understand the importance of precise source citations, which is why Bard now offers more precise source citations when generating responses. This ensures accuracy and reliability in the information provided by Bard.

Additionally, we’re introducing a Dark theme for coding in Bard. This feature not only adds a touch of personalization but also provides a comfortable coding experience, especially for those working in low-light environments. We want developers to feel empowered and inspired as they unleash their creativity through Bard.

To make coding workflows even more seamless, we’ve partnered with Replit, a leading platform for collaborative coding. With Replit integration, developers can export and run code directly in Bard, starting with Python. This partnership aims to enhance the coding experience and foster a supportive environment for developers.

App Integration for Enhanced Productivity

We firmly believe in the power of integration, and as Bard evolves, it will become increasingly integrated with various Google apps and services. Soon, you will be able to utilize Bard’s capabilities within Docs, Drive, Gmail, Maps, and more. Imagine effortlessly incorporating Bard’s generative AI into your everyday workflow, whether it’s for drafting documents, organizing your files, or planning your next trip.

But we’re not stopping there. We’re excited to announce our partnership with Adobe, a global leader in creative software. Through this collaboration, we aim to integrate Adobe’s generative AI models into Bard, enabling you to quickly create high-quality images. This integration opens up a world of possibilities for designers, content creators, and anyone seeking to bring their ideas to life with ease and efficiency.

Expanding Partnerships for a Wide Range of Services

To provide a comprehensive suite of services, we are actively seeking partnerships with industry leaders. Our goal is to collaborate with companies like Kayak, OpenTable, ZipRecruiter, Instacart, Wolfram, and Khan Academy, among others. These partnerships will enable Bard users to access a wide range of services seamlessly through the AI platform. From travel planning to job searches, from grocery shopping to educational resources, the potential for what Bard can assist with is boundless.

Conclusion

The future of Bard is bright and full of promise. With its expanded global reach, enhanced visual capabilities, coding upgrades, app integration, and growing partnerships, Bard is poised to become an indispensable tool in the hands of individuals worldwide. We are committed to maintaining the highest standards for quality and local nuances as we continue to improve and refine Bard’s offerings.

Stay tuned for more updates as Bard unleashes its full potential. The journey has just begun, and we can’t wait to see how Bard, in collaboration with its users, will shape the future of generative AI.

Tags: Bard, AI, Visual Communication, Coding, App Integration

[Reference Link](!https://blog.google/technology/ai/google-bard-updates-io-2023/)