useMinBidAmount
Hook for checking the validity of bid inputs.
import { useMinBidAmount } from '@public-assembly/builder-utils'
Usage
import { useMinBidAmount } from '@public-assembly/builder-utils'
function App() {
const { minBidAmount, bidAmount, updateBidAmount, isValidBid } =
useMinBidAmount()
return (
<>
<p>Minimum bid amount: {minBidAmount}</p>
<p>Supplied bid amount: {bidAmount}</p>
<p>Is the supplied bid valid?: {isValidBid}</p>
<form onSubmit={...}>
<input
placeholder={minBidAmount}
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
updateBidAmount(event.target.value)
}
/>
</form>
</>
)
}
Returns
{
minBidAmount: number
bidAmount: string
updateBidAmount: (value: string) => void
isValidBid: boolean
}