skip to Main Content

Reactjs – why is the useState hook being invoked twice?

Stackblitz: https://stackblitz.com/~/github.com/techybolek/DUP-TESTCASE git: https://github.com/techybolek/DUP-TESTCASE This example is intended to be a testcase demonstrating a duplicate hook for the following scenario: The user types in a query and presses the Send button A new Conversation object is initialized and added to…

VIEW QUESTION

Javascript – How to fetch in Server Components?

This is how I handle fetch now following the next’s document. https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#fetching-data-on-the-server-with-fetch async function getSuite(propertyId: string, suiteId: string) { const cookieStore = cookies(); const accessToken = cookieStore.get("accessToken"); const res = await fetch( `${process.env.NEXT_PUBLIC_API_BASE_URL}/suite`, { headers: { "X-Authorization": "Bearer " +…

VIEW QUESTION
Back To Top
Search