-
-
Notifications
You must be signed in to change notification settings - Fork 0
Docs
Irham Putra edited this page Apr 13, 2020
·
7 revisions
setFormat(params):
-
amount
type number -
locale
type string (Popular locale: 'id' for Indonesia, 'us' for United States, 'de' for Germany) -
currency
type string ('EUR', 'IDR, 'USD')
You can format your number from your input field
import { useFormatMoney } from 'react-use-pkg';
const Component = () => {
const {value, setFormat} = useFormatMoney()
return (
<div>
<button onClick(() => setFormat(1000000, 'us', 'USD'))>Format money!</button>
{value}
</div>
)
}
This hooks has asnyc function, so it might be a take a while to processed.
Available only in Germany ('de') and US ('us')
import { useZipCode } from 'react-use-pkg';
const Component = () => {
const {value, setCodeCountry} = useZipCode()
return (
<div>
<button onClick(() => setCodeCountry('de', 04177))>Get data</button>
{JSON.stringify(value, null, 2)}
</div>
)
}
If you have struggle with CORS already, this hooks will fix it in client
import { useFetchWithCORS } from 'react-use-pkg';
const Component = () => {
const {data, setURI} = useFetchWithCORS()
return (
<div>
<button onClick(() => setURI('yourTroubleURI.com'))>Get data</button>
{JSON.stringify(data, null, 2)}
</div>
)
}