diff --git a/context/index.js b/context/index.js new file mode 100644 index 0000000..e28a9e5 --- /dev/null +++ b/context/index.js @@ -0,0 +1,17 @@ +import React, { useState, createContext } from "react"; + +export const Context = createContext(); + +export const ContextProvider = (props) => { + const [username, setUsername] = useState(""); + const [secret, setSecret] = useState(""); + + const value = { + username, + setUsername, + secret, + setSecret, + }; + + return {props.children}; +}; diff --git a/pages/_app.js b/pages/_app.js index ccb4308..5b2a830 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -2,12 +2,12 @@ import "../styles/auth.css"; import "../styles/chats.css"; import "../styles/index.css"; -// import { ContextProvider } from '../context' +import { ContextProvider } from "../context"; export default function App({ Component, pageProps }) { return ( - // - - // + + + ); }