Skip to content

Instantly share code, notes, and snippets.

@pablorn91
pablorn91 / Hook para Context
Created March 13, 2022 13:35
Crear un Hook personalizado para facilitar uso de Context
import { useContext } from "react";
import NombreContext from "../context/NombreProvider";
const useNombre = () => {
return useContext(NombreContext)
}
export default useNombre
@pablorn91
pablorn91 / React Context
Last active March 13, 2022 13:36
Crear un Context en React
import { createContext } from 'react'
const NombreContext =createContext()
const NombreProvider = ({children}) => {
//definir state, effects y funciones propias
return (
<NombreContext.Provider