14 lines
429 B
JavaScript
14 lines
429 B
JavaScript
import React, { createContext } from "react";
|
|
import useSocket from "./useSocket"; // Import the custom hook
|
|
|
|
// Create the SocketContext
|
|
const SocketContext = createContext(null);
|
|
|
|
export const SocketProvider = ({ children, bodyshop }) => {
|
|
const { socket, clientId } = useSocket(bodyshop);
|
|
|
|
return <SocketContext.Provider value={{ socket, clientId }}> {children}</SocketContext.Provider>;
|
|
};
|
|
|
|
export default SocketContext;
|