We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#30 を転記しました。@tatsuya19881021
getStaticProps
catch
return
return { props: { err: 'データ取得で問題が発生しました。', }, };
↓ 下記のような、data を入れなくても問題無いか?↓
return { props: { data: { err: 'データ取得で問題が発生しました。', }, }, };
The text was updated successfully, but these errors were encountered:
これどうなのでしょうか?調べたら次の記述もありました。
https://stackoverflow.com/questions/67168743/how-to-cleanly-handle-errors-in-nextjs-getstaticprops
export const getStaticProps = async () => { try { const { data, errors } = await someQuery(); if (errors || !data) { return { notFound: true }; } return { props: { data } }; } catch () { return { notFound: true }; } };
Sorry, something went wrong.
なるほどー。動作上、問題ないなら良いと思ってますが… 書き方は難しいですね〜。
単純にエラー時の挙動がおかしくないか?ってのだけ気になりました🙇
No branches or pull requests
#30 を転記しました。@tatsuya19881021
getStaticProps
関数のcatch
処理。return
のデータ構造は正しい?↓ 下記のような、data を入れなくても問題無いか?↓
The text was updated successfully, but these errors were encountered: