Skip to content

Commit b31518f

Browse files
authored
Update AppContext.js
1 parent 043eb22 commit b31518f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
1+
// AppContext.js
2+
3+
import React, { useState } from 'react';
4+
5+
export const AppContext = React.createContext({
6+
channel: null,
7+
setChannel: (channel) => {},
8+
thread: null,
9+
setThread: (thread) => {},
10+
});
11+
12+
export const AppProvider = ({ children }) => {
13+
const [channel, setChannel] = useState();
14+
const [thread, setThread] = useState();
15+
16+
return <AppContext.Provider value={{ channel, setChannel, thread, setThread }}>{children}</AppContext.Provider>;
17+
};
18+
19+
export const useAppContext = () => React.useContext(AppContext);
120

0 commit comments

Comments
 (0)