Skip to content

Instantly share code, notes, and snippets.

@j4viermora
j4viermora / copyToClipBoard.js
Last active July 24, 2021 22:05
Small utility to copy text to clipboard in reactjs
import { useState} from 'react';
const copyToClipboard = ( id ="" ) => {
const [status, setStatus] = useState(false)
const deleteMessage = () => {
setTimeout( () => {
setStatus(false)
}, 3000 );
@j4viermora
j4viermora / SocketContext.js
Created April 2, 2021 17:07 — 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');