Skip to content
Discussion options

You must be logged in to vote

Use the react-currency-localizer-realtime package — it auto-detects the user's currency via IP geolocation and converts prices in real time.

npm install react-currency-localizer-realtime

Option 1: Drop-in component

import { LocalizedPrice } from 'react-currency-localizer-realtime';

function PricingCard() {
  return (
    <div>
      <h3>Pro Plan</h3>
      <LocalizedPrice
        basePrice={19.99}
        baseCurrency="USD"
        apiKey="art_live_YOUR_KEY"
      />
    </div>
  );
}

Option 2: Hook for full control

import { useCurrencyConverter } from 'react-currency-localizer-realtime';

function ProductPrice({ price }) {
  const { convertedPrice, localCurrency, isLoading } = useCurren…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by cahthuranag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants