Skip to content

Commit 2c3e5b8

Browse files
committed
Fix Destructuring Error - setLoading(true)
1 parent e674e02 commit 2c3e5b8

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

src/App.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@ import SetupForm from "./SetupForm";
55
import Loading from "./Loading";
66
import Modal from "./Modal";
77
function App() {
8-
const {
9-
waiting,
10-
loading,
11-
questions: tempQuestions,
12-
index,
13-
correct,
14-
} = useGlobalContext();
8+
const { waiting, loading, questions, index, correct } = useGlobalContext();
159

1610
if (waiting) {
1711
return <SetupForm></SetupForm>;
@@ -21,11 +15,6 @@ function App() {
2115
return <Loading></Loading>;
2216
}
2317

24-
const questionsData = { ...tempQuestions[0] };
25-
console.log(questionsData);
26-
const { correct_answer, incorrect_answers, question } = questionsData;
27-
const answers = [...incorrect_answers, correct_answer];
28-
console.log(answers);
2918
return <main>quiz</main>;
3019
}
3120

src/context.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const AppProvider = ({ children }) => {
2626
const [isModalOpen, setIsModalOpen] = useState(false);
2727

2828
const fetchQuestions = async (url) => {
29-
setLoading(false);
29+
setLoading(true);
3030
setWaiting(false);
3131
const response = await axios(url).catch((error) => console.log(error));
3232

0 commit comments

Comments
 (0)