From the course: Master React 19 and Next.js 16 with Hands-On Projects and Real-World Applications

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Third-party components

Third-party components

Hello and welcome! In this session, I'm going to guide you through one of the most common challenges when working with Next.js 16 and the App Router – integrating third-party components that rely on client-side features. By default, Next.js components are server components which offer fantastic performance benefits but cannot use hooks like uState or UEffect, or interact with browser APIs like the DOM. Many libraries, especially for UI elements like notifications, modals, or interactive charts, are built with these client-side features in mind. Our goal is to learn how to bridge this gap safely and efficiently. You will learn how to identify when a library is client-only, how to create a special wrapper component to make it compatible with the server-first environment, and how to use your new safe component within your application. Now before we write any new code, let's define our task. I want to add a notification system to our app, so when a user submits a form, they get a nice…

Contents