Current collected state Current
Observed since 20 Oct, 23:18 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
React hooks to get prices of cryptocurrency coins and tokens from CoinGecko.
react-coingeckoReact hooks to get prices of cryptocurrency coins and tokens from CoinGecko.
Install the package:
npm install @0xflair/react-coingecko
Install peer dependencies:
npm install axios
# if visual components needed:
npm install tailwindcss @headlessui/react @heroicons/react @tailwindcss/aspect-ratio
Configure tailwind.config.js (Tailwind v3) to scan SDK for classes (if visual components needed):
module.exports = {
purge: [
"./public/**/*.html",
"./src/**/*.{js,jsx,ts,tsx,vue}",
// This line tells Tailwind to look into SDK files
"./node_modules/@0xflair/**/*.{js,jsx,ts,tsx,vue}",
],
content: ["./src/**/*.{js,jsx,ts,tsx}"],
plugins: [
// These plugins are used in this package
require("@tailwindcss/forms"),
require("@tailwindcss/aspect-ratio"),
],
};
Configure the React provider:
const cryptoPricesConfig = {
coinGecko: {
apiKey: "xxxx",
symbols: ["ethereum", "matic-network"],
},
};
const App = () => {
return (
<div className="app">
<CoinGeckoProvider config={cryptoPricesConfig}>
<HookExample />
</CoinGeckoProvider>
</div>
);
};
import { CryptoPrice, CryptoUnits } from "@0xflair/react-coingecko";
function App() {
return (
<>
<CryptoPrice value='0.06' unit={CryptoUnits.ETHER} />
</>
);
import { useCryptoPrice } from "@0xflair/react-coingecko";
function App() {
const [{data, error, loading}, fetchPrice] = useCryptoPrice({
symbol: 'ethereum'
});
return (
<ul>
<li>Price of Ether: {data.usd} USD</li>
<li>Loading: {loading ? 'Yes...' : 'Idle'}</li>
<li>Error: {error}</li>
</ul>
);
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.123.2Registry latest | 27 Nov 2022 | 10 | |
| 0.123.1 | 12 Nov 2022 | 10 | |
| 0.123.0 | 8 Nov 2022 | 10 | |
| 0.122.2 | 28 Oct 2022 | 10 | |
| 0.122.1 | 28 Oct 2022 | 10 | |
| 0.122.0 | 28 Oct 2022 | 10 | |
| 0.121.2 | 27 Oct 2022 | 10 | |
| 0.121.1 | 24 Oct 2022 | 10 | |
| 0.121.0 | 20 Oct 2022 | 10 | |
| 0.120.11 | 20 Oct 2022 | 10 | |
| 0.120.10 | 19 Oct 2022 | 10 | |
| 0.120.9 | 10 Oct 2022 | 10 | |
| 0.120.8 | 10 Oct 2022 | 10 | |
| 0.120.7 | 10 Oct 2022 | 10 | |
| 0.120.6 | 3 Oct 2022 | 10 | |
| 0.120.5 | 3 Oct 2022 | 10 | |
| 0.120.4 | 3 Oct 2022 | 10 | |
| 0.120.3 | 3 Oct 2022 | 10 | |
| 0.120.2 | 3 Oct 2022 | 10 | |
| 0.120.1 | 30 Sept 2022 | 10 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 23:18 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:37c8edfd4f331902983bc2c2a95a2fad3a447a0163128ae9284d39cb438ee7c5