Created the StateContext.jsx
This commit is contained in:
1 parent
1587757e69
commit
4bb9b3f974
1 file changed
+13
@@ -0,0 +1,13 @@
|
||||
import {createContext, useState} from "react";
|
||||
|
||||
export const StateContext = createContext({});
|
||||
|
||||
export const StateProvider = ({ children }) => {
|
||||
const [currentState, setCurrentState] = useState("Home");
|
||||
|
||||
return (
|
||||
<StateContext.Provider value={{currentState, setCurrentState}}>
|
||||
{children}
|
||||
</StateContext.Provider>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user