()
| 118 | }; |
| 119 | |
| 120 | export const useSocket = () => { |
| 121 | const context = useContext(SocketContext); |
| 122 | |
| 123 | if (!context) { |
| 124 | throw new Error("useSocket must be nested in SocketProvider"); |
| 125 | } |
| 126 | |
| 127 | return context; |
| 128 | }; |
| 129 | |
| 130 | export default SocketProvider; |
| 131 |