Tei*_*eah 1 reactjs react-native next.js
如果反应中满足条件,如何将 const 重新分配为 true?它不断显示错误“displayInternalForm”已声明,但其值从未被读取。
export async function getStaticProps({ params }) {
const displayInternalForm = false;
const internalJob = internalcategory.categories.find((cat) =>
cat.id?.includes("a5c26877-e89c-440b-b7a0-31552865fff5"));
if (internalJob !== undefined) {
// It is not reading this line of code.
const displayInternalForm = true;
}
}
Run Code Online (Sandbox Code Playgroud)
let如果重新分配变量,则应该使用。
在这里阅读更多内容
export async function getStaticProps({ params }) {
let displayInternalForm = false;
const internalJob = internalcategory.categories.find((cat) =>
cat.id?.includes("a5c26877-e89c-440b-b7a0-31552865fff5"));
if (internalJob !== undefined) {
// It is not reading this line of code.
displayInternalForm = true;
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
168 次 |
| 最近记录: |