import React, { createContext, useContext, useEffect, useState } from "react"; const Crypto = createContext(); const CryptoContext = ({ children }) => { const [currency, setCurrency] = useState("INR"); const [symbol, setSymbol] = useState("₹"); useEffect(() => { if (currency === "INR") setSymbol("₹"); else if (currency === "USD") setSymbol("$"); }, [currency]); return ( {children} ); }; export default CryptoContext; export const CryptoState = () => { return useContext(Crypto); };