Skip to content

Instantly share code, notes, and snippets.

View Taynan-Vieira's full-sized avatar

Taynan Vieira Taynan-Vieira

  • Avanade
  • Recife - Brasil
View GitHub Profile
@Taynan-Vieira
Taynan-Vieira / NumberFormat.tsx
Last active November 26, 2021 23:30
Text Currency Format
import React from 'react';
import NumberFormat, { FormatInputValueFunction } from 'react-number-format';
interface NumberFormatCustomProps {
inputRef: (instance: NumberFormat | null) => void;
onChange: (event: { target: { value: string } }) => void;
}
const currencyFormatter: FormatInputValueFunction = (value: string) => {
if (!Number(value)) return '';