API de Contexto
Provedores de que você vai precisar.
Visão geral
Gerenciamento de Estado Global das Abas
"use client";
import { createContext, useContext, useState, ReactNode } from "react";
type Tabs = "deploy" | "escrow" | "helper";
interface TabsContextType {
activeTab: Tabs;
setActiveTab: (tab: Tabs) => void;
}
const TabsContext = createContext<TabsContextType | undefined>(undefined);
export function useTabsContext() {
const context = useContext(TabsContext);
if (!context) {
throw new Error("useTabsContext must be used within TabsProvider");
}
return context;
}
export function TabsProvider({ children }: { children: ReactNode }) {
const [activeTab, setActiveTab] = useState<Tabs>("deploy");
return (
<TabsContext.Provider value={{ activeTab, setActiveTab }}>
{children}
</TabsContext.Provider>
);
}
Gerenciamento de Estado Global do Escrow
Gerenciamento de Estado Global da Carteira
Provider Global
Atualizado