Skip to content

Commit a2f693d

Browse files
committed
API Overview
1 parent 8f98906 commit a2f693d

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/context.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
1-
import axios from 'axios'
2-
import React, { useState, useContext, useEffect } from 'react'
1+
import axios from "axios";
2+
import React, { useState, useContext, useEffect } from "react";
33

44
const table = {
55
sports: 21,
66
history: 23,
77
politics: 24,
8-
}
8+
};
99

10-
const API_ENDPOINT = 'https://opentdb.com/api.php?'
10+
const API_ENDPOINT = "https://opentdb.com/api.php?";
1111

12-
const url = ''
12+
const url = "";
1313

14-
const AppContext = React.createContext()
14+
const tempUrl =
15+
"https://opentdb.com/api.php?amount=10&category=21&difficulty=easy&type=multiple";
16+
17+
const AppContext = React.createContext();
1518

1619
const AppProvider = ({ children }) => {
17-
return <AppContext.Provider value='hello'>{children}</AppContext.Provider>
18-
}
20+
return <AppContext.Provider value="hello">{children}</AppContext.Provider>;
21+
};
1922
// make sure use
2023
export const useGlobalContext = () => {
21-
return useContext(AppContext)
22-
}
24+
return useContext(AppContext);
25+
};
2326

24-
export { AppContext, AppProvider }
27+
export { AppContext, AppProvider };

0 commit comments

Comments
 (0)