Skip to content

Commit 71a2a69

Browse files
committed
🐛 Fix sample code + Update CodeSandbox URL
Fixes #110
1 parent 25d9351 commit 71a2a69

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

README.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# react-otp-input
22

3-
[![npm version](https://badge.fury.io/js/react-otp-input.svg)](https://badge.fury.io/js/react-otp-input) [![npm](https://img.shields.io/npm/dw/react-otp-input.svg?logo=npm)](https://www.npmjs.com/package/react-otp-input)
3+
[![npm version](https://badge.fury.io/js/react-otp-input.svg)](https://badge.fury.io/js/react-otp-input) [![npm](https://img.shields.io/npm/dw/react-otp-input.svg?logo=npm)](https://www.npmjs.com/package/react-otp-input)
44

55
A fully customizable, one-time password input component for the web built with React.
66

77
![see here](https://media.giphy.com/media/lN98dFU6h3oP0wWS5x/giphy.gif)
88

99
[Live Demo](https://devfolioco.github.io/react-otp-input)
1010

11-
[CodeSandbox](https://codesandbox.io/s/0y849kwoqv)
11+
[CodeSandbox](https://codesandbox.io/s/react-otp-input-demo-v2-1iy52)
1212

1313
## Installation
1414

@@ -22,26 +22,23 @@ npm install --save react-otp-input
2222

2323
#### Basic usage:
2424

25-
```javascript
25+
```jsx
2626
import React, { Component } from 'react';
2727
import OtpInput from 'react-otp-input';
2828

2929
export default class App extends Component {
30-
state = {
31-
otp: '',
32-
};
30+
state = { otp: '' };
3331

3432
handleChange = otp => this.setState({ otp });
3533

3634
render() {
3735
return (
38-
<div>
39-
<OtpInput
40-
onChange={this.handleChange}
41-
numInputs={6}
42-
separator={<span>-</span>}
43-
/>
44-
</div>
36+
<OtpInput
37+
value={this.state.otp}
38+
onChange={this.handleChange}
39+
numInputs={6}
40+
separator={<span>-</span>}
41+
/>
4542
);
4643
}
4744
}
@@ -193,4 +190,3 @@ Feel free to open [issues](https://github.com/devfolioco/react-otp-input/issues/
193190
## License
194191

195192
[![NPM](https://img.shields.io/npm/l/react-otp-input)](https://github.com/devfolioco/react-otp-input/blob/master/LICENSE)
196-

0 commit comments

Comments
 (0)