score:0

Accepted answer
import React, { useContext } from "react";
import SocketContext from "../SocketContext";

const RandomComponent = () => {
  const { socket } = useContext(SocketContext);

  React.useEffect(() => {
    console.log(socket);
  }, [socket]);
  return <div></div>;
};


Related Query

More Query from same tag