Questions tagged [react-server-components]

React Server Components is a subset of React.js, it allows loading components from the backend. The components have already been rendered in the backend and can be seamlessly integrated into the running app. This feature is still in experiment.

123 questions
0
votes
1 answer

Fetching isn't done in production build, while it is done in development for Nextjs server component

SOLVED I was about to use internationalization for translating the pages at the very beginning of the project. There are some codes for configuring internationalization in next.config.js like the following, all I need to do to get rid of the problem…
0
votes
0 answers

Does cloning React elements that are server components cancel the performance benefit?

I have been trying out React Server Components in NextJS 13. I have stumbled on a case when I need to use the pattern of passing server components as props in a client component. The thing is, this is a HOC wrapper that attaches an onClick handler…
0
votes
1 answer

Next.js 13: Can this components use server component and client component together for better performance? How to achieve it?

Introduce I'm curently learning server and client components in Next.js 13 and wants to implement it in my project. I have a container component that uses react-intersection-observer to determine which section is in view and updates the active…
0
votes
0 answers

NextJS 13 Build-Time Data Fetching

I have NextJS 13 application and trying to deploy to docker via GitHub Actions And I use server component and doing some ec2 actions but I got error when I deployed to GitHub 31 550.4 > Build error occurred #31 550.4 Error: Collecting page data for…
0
votes
0 answers

Is it possible to use Context values in Server Components?

In my apps my store is usually the main abstraction layer that sits between the app and the API. By ensuring my React tree only references store methods when making API calls, I have a clear separation of concerns and am able to edit API related…
styke
  • 2,116
  • 2
  • 23
  • 51
0
votes
0 answers

Next13 : How to update an API parameter in parent server component from child client component

I'm testing next13 and have the following code structure. A parent server component calls an API to generate a list of countries, passed to a child client component displaying a select. The parent component also calls another API to generate a list…
0
votes
1 answer

NextAuth React Server Components Dynamic server usage Error

Been trying to use react server components, however, I'm stuck at retrieving session data from next auth. The recommended way to do this is getServerSession which throws an error: Error: Dynamic server usage: force-dynamic As per docs, I've set…
Exanubes
  • 133
  • 2
  • 13
0
votes
1 answer

Trigger server action on click in next 13

In my client component I want to create a new Todo: "use client"; const ClientComp:FC<{ createTodo: (title:string) => void }> = ({ createTodo }) => { return ( ) } Now in my…
Sventies
  • 2,314
  • 1
  • 28
  • 44
0
votes
0 answers

Avoid redundant fetch in React Server Component

In a server component and using the fetch() API, is there an elegant way to check if the fetched resource is already cached on the nextJS server and to not fetch it from the remote server if it isn't? (remote server= not nextJS but a 3rd party…
0
votes
1 answer

How to pass a component as a prop using Next 13

I have a client component called Tab: import * as React from "react"; import type { IconType } from "react-icons"; type TabProps = { Icon: IconType; label: string; isActive?: boolean; }; export default function Tab({ Icon, label, …
prismo
  • 1,505
  • 2
  • 12
  • 26
0
votes
0 answers

Next 13 Postgres client connection occurs after server components

I have a Next.js 13 project with the app directory which connects successfully to a postgres database. What I want to do is to connect to Postgres once, and then export the connection across my app so I will be able to perform queries from server…
IdoBa
  • 63
  • 6
0
votes
1 answer

How to reuse functional components in Next.js 13 Server Components

I cannot separate the logic from the component with this error: Error: Event handlers cannot be passed to Client Component props.