From 7809ccbba56be8c5377f94cf2d287a0e1521fdc1 Mon Sep 17 00:00:00 2001 From: Alberto Duarte Delgado Date: Wed, 25 Mar 2026 15:32:20 +0000 Subject: Initial commit: App Oficina base project --- src/context/AppContextProvider.tsx | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/context/AppContextProvider.tsx (limited to 'src/context/AppContextProvider.tsx') diff --git a/src/context/AppContextProvider.tsx b/src/context/AppContextProvider.tsx new file mode 100644 index 0000000..75ece38 --- /dev/null +++ b/src/context/AppContextProvider.tsx @@ -0,0 +1,39 @@ +import React, { Dispatch, SetStateAction, createContext, useContext, useState } from 'react'; + +export type Usuario={ + id: string, + nick: string, + rol?: string +} + +export interface AppContextType{ + + listaUsuarios: Usuario[], + + setListaUsuarios: Dispatch> +} + +export const AppContext = createContext({} as AppContextType); + +const AppContextProvider = (props: any) => { + const [listaUsuarios, setListaUsuarios] = useState([]); + + + const contextValues: AppContextType = { + + listaUsuarios: listaUsuarios, + + setListaUsuarios: setListaUsuarios + } + return ( + + {props.children} + + ) +} + +export const useAppContext = () =>{ + return useContext(AppContext); +} + +export default AppContextProvider \ No newline at end of file -- cgit v1.2.3-54-g00ecf