how do I get coins with hyphenated id from coin gecko? All other coin ids without hyphens seem to work fine

Viewed 34

import { useParams } from "react-router-dom";

`const CoinPage = () => { const {id} = useParams([]); const [coin, setCoin] = useState();

const { currency, symbol } = CryptoState();

const fetchCoin = async () => { const { data } = await axios.get(SingleCoin(id));

setCoin(data);

};

useEffect(() => { fetchCoin();

}, []);`

my api:

export const SingleCoin = (id) => https://api.coingecko.com/api/v3/coins/${id};

all other coins without hyphen work fine, apart from those with hyphens. Am totally knew and confused

0 Answers
Related