cost 250 ms
使用中間件時,客戶端未定義 getServerSideProps 道具

[英]getServerSideProps props are undefined on client-side when using middleware

賞金將在 6 天后到期。 此問題的答案有資格獲得+50聲望賞金。 kennsorr想讓更多人關注這個問題。 如果使用 Nextjs 中間件滿足特定條件,我將嘗試在每個頁面上進行重定向。 出於某種原因,每當 middleware.ts 中的matcher匹配頁面時,該頁面上getServerSid ...

將 object 從一頁傳遞到另一頁 NextJS

[英]pass object from one page to another page NextJS

我想將嵌套的 object 數據從一頁傳遞到下一頁。 我想傳遞 object。我們不能使用 localStorage 或 sessionStorage,因為我們必須使用 getServerSideProps 中的 object 值。 我們在這里不使用路由器查詢,因為它傳遞了一個采用密鑰對值的查詢。 ...

versel 不從 getServerSideProps nextjs 方法返回 i18nexus 鍵值

[英]versel does not return i18nexus key values from the getServerSideProps nextjs method

我遇到了這個問題:我使用 next-i18next 為我的站點添加了一個翻譯,以便開發更快,我使用了 i18nexus。 當我開發應用程序時,我沒有任何問題。 但是當上傳到 Versel 時,i18nexus 的值根本不顯示(只輸出鍵的名稱)。 對於 output,我使用 getServerSide ...

可以在應用程序目錄中的客戶端組件上使用 getServerSideProps 嗎?

[英]Is possible to use getServerSideProps on client components inside app dir?

所以基本上我想在應用程序目錄中的客戶端組件上使用 getServerSideProps 如果我在終端和瀏覽器控制台中控制台記錄 props.data,這將返回未定義。 我不知道我是否在這里做錯了什么。 我要獲取的 api 是內部的。 我嘗試在服務器組件上使用 getServerSideProps ...

在動態路由中使用 getServerSideProps

[英]Use getServerSideProps in Dynamic Routes

我正在嘗試在我的文件[username].js (使用動態路由)中使用getServerSideProps 。 要在next.js中使用動態路由,需要用到getStaticPaths()和getStaticProps({ params })這兩個函數。 但是,您不能將getServerSidePr ...

使用 Context 和 Firestore 預呈現 NextJS 時出錯

[英]Error prerendering NextJS with Context and Firestore

我正在嘗試將我的 React 簡單電子商務應用程序轉換為 NextJS,但在弄清楚如何在使用 Context 時預呈現我的產品數據時遇到了問題。 問題是,我不需要像基於訂單的產品數量那樣的動態更新系統,因為這只是一個演示應用程序,所以我應該能夠預渲染所有內容並使用 getStaticProps 和 ...

使用 Jenkins CD 的 getServerSideProps 出現錯誤 401

[英]I have an error 401 with getServerSideProps with Jenkins CD

我想為我的網站安裝 CI/CD(帶有 NextJS、apollo-graphql、prisma 的全棧),所以我在我的服務器上安裝了 jenkins。 我安裝了 nginx 和 pm2 來啟動/重啟我的網站。 當我以 root 用戶啟動服務器時,一切正常,我在前端獲取數據沒有問題。 之后,我決定在 ...

我不斷收到““無法讀取未定義的屬性(讀取“地圖”)””

[英]I keep getting ""Cannot read properties of undefined (reading 'map')""

我目前正在使用 Nextjs 13 來構建我的前端,我想從鏈接中獲取 a.joson 並使用它來使用服務器端渲染來填充我的網站,但我不斷收到此錯誤“無法讀取未定義的屬性(讀取'地圖')" 當我使用 getstaticprops 時一切正常,但是當我使用 getserversideprops 時遇到 ...

如何在下一個 js 的 getServerSideprops 內的 groq 健全性查詢中使用查詢參數作為變量?

[英]How to use query param as a variable in groq sanity query inside getServerSideprops in next js?

我正在嘗試在我的博客項目中實現搜索功能,但在 getServersideprops 內的 groq 查詢(健全性)中使用變量時遇到問題。 這是我的代碼 這是我得到的錯誤 **服務器錯誤 ClientError:參數 $search 被引用,但未提供 ** 但是當用實際字符串替換變量時,我會成功獲得 ...

如何在 NextJS 中使用 getServerSideProps() 改進 SEO?

[英]How to improve SEO with getServerSideProps() in NextJS?

我有一個網站會顯示動態數據(文章),即每小時變化的數據。 因此,我選擇使用 NextJS 的getServerSideProps() 。 我無法使用getStaticPaths()因為數據變化如此頻繁,在構建站點一小時后,所有 static 路徑將指向過期文章,並且所有新文章都沒有任何指向它們的路 ...

使用 Typescript 在 Next 中的嵌套頁面未調用 GetServerSideProps

[英]GetServerSideProps not getting called for nested page in Next with Typescript

我在 /article/[id] 處設置了一個頁面,該頁面應該使用 getServerSideProps 獲取該 id 的文章。 似乎根本沒有調用 getServerSideProps,因為我沒有看到任何控制台日志。 當我導航到該頁面時,它顯示“TypeError:無法讀取未定義的屬性(讀取'標題 ...

在現實世界場景中何時使用 getStaticProps 和 getServerSide 道具

[英]When to use getStaticProps and getServerSide props in real world scenario

您好,我是 Next.js 的新手,我知道在 getStaticProps Next.js 將在構建時預渲染此頁面,在 getServerSideProps Next.js 中,將使用獲取服務器返回的每個請求的數據預渲染此頁面但我想要一個何時使用 getStaticProps 和 getServer ...

未處理的運行時錯誤類型錯誤:無法訪問屬性“電子郵件”,用戶未定義 [NEXTJS]

[英]Unhandled Runtime Error TypeError: can't access property "email", user is undefined [NEXTJS]

我的下一個應用程序中有一個 /session/profile 路由,只要有用戶登錄,它就會呈現一個名為 UserProfile 的組件: profile.js import { useRouter } from 'next/router'; import React, { useEffect ...

_app加載時是否有某種方法可以從服務器讀取道具

[英]Is there some way to read props from the server when _app loads

我想根據我的 /pages 目錄創建一個動態導航菜單,以在我添加新文件時掃描文件夾並自動更新菜單鏈接。 我正在分階段嘗試。 第 1 階段:我創建了一個獨立的導航欄頁面,它有自己的 getServerSideProps 來讀取文件系統並返回 /pages。 這工作正常。 第 2 階段:我希望在每個頁面 ...

如何使用 `getServerSideProps` 修復頁面無法導出

[英]How to Fix Pages with `getServerSideProps` can not be exported

我有一個 Next Js 應用程序,其中包含帶有 getServerSideProps 的頁面。 我現在正在嘗試 npm 運行構建並將 npm 導出,這樣我就可以獲取“Out”文件夾並將其托管在 firebase 上,但在pages with "getServerSideProps" can not ...

如何在 getServerSideProps NextJS 中獲取 cookies

[英]How to get cookies in getServerSideProps NextJS

在我的用戶頁面中,我使用getServerSideProps來獲取用戶的數據。 在第 1 號console.log中,您可以看到帶有令牌的cookies存在。 但是在 console.log 編號 2 cookies是空的我也在useEffect中做了同樣的請求,它按我的預期工作。 在consol ...


 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM