> A zero-dependency React Hook to show and get the brand from a card type.
npm install react-card-brand> A zero-dependency React Hook to show and get the brand from a card type.
``sh`
$ npm i -S react-card-brand
or install with Yarn if you prefer:
`sh`
yarn add react-card-brand
You can import useCardBrand into your component and use the getSvgProps callback to get a current brand from your card type.
`js
import React from 'react';
import { useCardBrand, images } from 'react-card-brand';
export default function Example() {
const { getSvgProps } = useCardBrand();
return (
$3
You can use the
getCardType function to get the brand from a card number.`js
import React from 'react';
import { useCardBrand, images } from 'react-card-brand';export default function Example() {
const { getSvgProps, getCardBrand } = useCardBrand();
const type = getCardBrand('4242424242424242');
return (
);
}
``All feedback and suggestions are welcome!
This is a open-source software licensed under the MIT license