-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontext.js
37 lines (29 loc) · 868 Bytes
/
context.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import React, { useState, createContext } from 'react'
export const GlobalContext = createContext()
const GlobalProvider = ({ children }) => {
const [loggedIn, setLoggedIn] = useState(false)
const [token, setToken] = useState("")
const [Id, setId] = useState("")
const [emailToken, setEmailToken] = useState("")
const [user, setUser] = useState([])
const [posts, setPosts] = useState([])
return(
<GlobalContext.Provider value={{
loggedIn,
token,
user,
posts,
emailToken,
Id,
setLoggedIn,
setToken,
setEmailToken,
setUser,
setPosts,
setId
}}>
{children}
</GlobalContext.Provider>
)
}
export default GlobalProvider