Skip to content

Commit

Permalink
fix(core-components-bank-card): deleting issue, add useCallback (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
reme3d2y committed Oct 13, 2020
1 parent b408b74 commit 5f768bd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/bank-card/src/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,11 @@ export const BankCard = React.forwardRef<HTMLInputElement, BankCardProps>(

const [brandIcon, setBrandIcon] = useState<ReactNode>(getBrandIcon(value));

const getMask = (newValue: string) =>
newValue.length <= cardMask.length ? cardMask : accountNumberMask;
const getMask = useCallback(
(newValue: string) =>
newValue.length <= cardMask.length ? cardMask : accountNumberMask,
[],
);

const handleInputChange = useCallback(
(event: ChangeEvent<HTMLInputElement>, payload) => {
Expand Down

0 comments on commit 5f768bd

Please sign in to comment.