Skip to content

How to use PhotoAlbum with renderPhoto in a server component #139

Answered by igordanchenko
onmybob asked this question in Q&A
Discussion options

You must be logged in to vote

You are probably confusing two different server-related concepts - Server Side Rendering (SSR) and React Server Components (RSC). It sounds like you are trying to render PhotoAlbum inside a server component. You can't use renderPhoto render function in this case because plain functions can't cross the boundary between server components and client components. To address this issue, you need to render PhotoAlbum in a client component (a file annotated with the "use client" directive). For example, you can refactor your code and introduce PhotoGallery client component as follows.

"use client";

import PhotoAlbum from "react-photo-album";

export default function PhotoGallery() {
  return <Ph…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by igordanchenko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants