react-server-components Questions

3

I've successfully tested one isolated server component by using an async it and awaiting the output of a call to the component as a plain function to pass into render: it('renders the user data wh...

2

Solved

I'm trying to make a page transition with Next.js v14 but no success. No error is shown, the animation just does't work. I guess it's because the layout.tsx is rendered on the server. But how can I...
Modred asked 5/12, 2023 at 0:32

2

In my client component I want to create a new Todo: "use client"; const ClientComp:FC<{ createTodo: (title:string) => void }> = ({ createTodo }) => { return ( <button onC...
Calle asked 8/7, 2023 at 12:48

2

I’ve been playing with React Server Components for nearly 2 weeks now and this question has been making my brain hurt: how do you provide context to server components? Like for example, providing a...

3

What is the proper way to implement the "useEffect" front-end functionality in Next.JS server components? Tried to use useEffect in the server side but it does not work. Do the usage of a...
Hyacinthe asked 10/11, 2023 at 2:44

4

I am experimenting with Next.js 13 app directory and React 18's Server Components. Following the documentation I put an async fetch() call inside a Server Component and I mark the component as asyn...
Rovit asked 7/3, 2023 at 18:11

4

I'm curious how we'd be able to go about accessing returned values from Next.js 13's alpha release of server actions. Here's the documentation from the Next team for reference. Let's say I have the...

7

Solved

So basically I have a server component in app dir and I want to get the pathname. I tried to do it using window.location but it does not work. Is there any way I can do this?
Equuleus asked 6/2, 2023 at 14:29

1

Solved

How do I use the my MUI (material ui) theme definition in a server component. I'm usually using the very useful useTheme hook. But this forces me to make it a client component, using the 'use clien...

4

In NextJs 13+ using the experimental App folder, async server components can be written, as described by the documentation: export default async function Page({ params: { username } }) { // Initia...

1

Im using nextJs for a while. Now initiating a new project using the app router (where traditional behavior is called the pages router). In the pages router, I could export getStaticProps to build p...
Meticulous asked 30/6, 2023 at 22:37

4

Solved

I have a server component InitView; const InitView = () => { useEffect(() => { }); return ( <> <Hero/> <span className="text-xl font-normal text-gray-100">Now...
Neptunian asked 24/3, 2023 at 8:9

1

I'm trying to set cookies inside the server actions function in Next.js 13.4.1. Example code import { cookies } from 'next/headers'; async function create(data) { 'use server'; cookies().set('n...
Eutrophic asked 8/5, 2023 at 10:0

2

Solved

I've migrated my personal page to the app directoy with nextjs v13. I was trying adding loaders for RSCs first in the fallback prop of the Suspense component and also adding a loading component loc...
Arawak asked 19/5, 2023 at 0:8

2

I am fetching (using Nextjs 13's fetch with {cache:'force-cache'}) from an api that returns a random joke. I noticed that fetch is being called twice during build. Here's my code: // page.js import...
Timbale asked 18/11, 2022 at 7:45

0

Lets consider this example of fetching first 3 pages of pagination during build time: app/listing-params/[page]/page.jsx const getData = async (page) => new Promise((resolve) => { setTimeou...
Pipage asked 21/5, 2023 at 9:16

1

Currently trying to refactor our project to use Server components (app directory), and the first challenge is how to implement infinite scroll pagination with new "app" directory. This is...
Pleonasm asked 16/5, 2023 at 19:43

1

Leaflet is imported in a file that's imported into a client component, so why is the server running it and throwing this error? It actually does work after a retry and eventually renders site...
Malloy asked 7/2, 2023 at 4:51

1

Im trying to understand React server components and how to render component state without the use of useState and useEffect. I have created a server component with an embedded client component and ...
Circumvallate asked 11/1, 2022 at 15:50

2

So this is a fairly new topic, React Server Components has recently been released, comparing to SSR/Next.js, how does it affect SEO? Since the component is rendered in the server dynamically when i...
1

© 2022 - 2025 — McMap. All rights reserved.