Skip to content

Instantly share code, notes, and snippets.

View manudevcode's full-sized avatar
🏠
Working from home

Manuel García manudevcode

🏠
Working from home
View GitHub Profile
@manudevcode
manudevcode / SocketContext.js
Created November 20, 2020 18:34 — forked from Klerith/SocketContext.js
Todo lo necesario para conectarnos a nuestro socket server - SocketContext, SocketProvider, useSocket
import React from 'react';
import { createContext } from 'react';
import { useSocket } from '../hooks/useSocket'
export const SocketContext = createContext();
export const SocketProvider = ({ children }) => {
const { socket, online } = useSocket('http://localhost:8080');