react-swedish-personal-identity-number-input
v0.4.3
Published
A higher order component for formatting values in input elements as Swedish personal identity numbers
Downloads
14
Readme
React Swedish personal identity number input
A higher order component for formatting values in input elements as Swedish personal identity numbers
Install
$ npm install --save react-swedish-personal-identity-number-input
Usage
import React from 'react';
import { createSwedishPersonalIdentityNumberInput } from 'react-swedish-personal-identity-number-input';
const YourInputComponent = ({ innerRef, ...rest }) => {
return <input ref={innerRef} {...rest} />;
}
const SwedishPersonalIdentityNumberInput = createSwedishPersonalIdentityNumberInput(YourInputComponent);
const Demo = () => {
const [value, setValue] = React.useState();
return <SwedishPersonalIdentityNumberInput value={value} onChange={setValue} />;
}
License
MIT © Jonathan Svenheden