Next.js · Senior · Question 22 of 75

A third-party component uses hooks but has no 'use client'. How do you use it in a server page?

Explanation

Create components/carousel.tsx: 'use client'; export { Carousel } from 'acme-carousel'. Now the server component imports the client wrapper. Many libraries have already added the directive themselves. Suspense has nothing to do with the client boundary.

Further reading

Problem with a question

Next.js · Senior · question 22

Test yourself

Take the Next.js · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz