小编Haz*_*aya的帖子

ReferenceError:初始化前无法访问“步骤”

我正在尝试在 ReactJS 中制作向导。我正在遵循在线教程,但是他们没有解释如何通过多个页面进行制作。于是我尝试了自己的方法去应用,但是并没有成功。

\n

这是第一页的代码:

\n
import React, { useState } from "react";\nimport { Button, Form } from "react-bootstrap";\nimport { Link } from "react-router-dom";\nimport "./style.css";\nfunction NewGame() {\n  const [activeStep, setActiveStep] = useState(steps[0]);\n  const [steps, setSteps] = useState([\n    {\n      key: "firstStep",\n      label: "My First Step",\n      isDone: true,\n      component: firstStep,\n    },  \n  ]);\n  const index = steps.findIndex((x) => x.key === activeStep.key);\n  setSteps((prevStep) =>\n    prevStep.map((x) => {\n      if (x.key === activeStep.key) x.isDone = true;\n      return x;\n    })\n  );\n \n  const firstStep …
Run Code Online (Sandbox Code Playgroud)

wizard reactjs

20
推荐指数
1
解决办法
7万
查看次数

当不通过源部署到托管时,如何提供选项?

我正在 React 中构建一个项目,它具有身份验证,所以我使用 firebase

我遇到过这个错误

Firebase:在不通过源部署到托管时需要提供选项。(应用程序/无选项)

这是我的 config-firebase 文件:

import { initializeApp } from "firebase/app";
import { getAuth } from "firebase/auth";

// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
  apiKey: "AIzaSyBoKEW_g0gOwNKkHGMAyhXxC0ESfdsVhKI",
  authDomain: "kargoevi-auth.firebaseapp.com",
  projectId: "kargoevi-auth",
  storageBucket: "kargoevi-auth.appspot.com",
  messagingSenderId: "726037811463",
  appId: "1:726037811463:web:42d75c7f5c1d1b5b9bf5a2",
  measurementId: "G-PJXGLVZ6GQ",
};

export const auth = getAuth(app);
const app = initializeApp(firebaseConfig);

export default app;
Run Code Online (Sandbox Code Playgroud)

这是我的身份验证文件:

import React, { useState, useEffect } from "react";
import { onAuthStateChanged } from "firebase/auth";
import { …
Run Code Online (Sandbox Code Playgroud)

javascript firebase reactjs

14
推荐指数
1
解决办法
2万
查看次数

标签 统计

reactjs ×2

firebase ×1

javascript ×1

wizard ×1