React-Tags-Editor that works out of the box
npm install react-tags-editor --save
- Simply add ReactTagsEditor component to use.
- Add ref to the component to get the current tags using
getTags()
import React, {Component} from 'react'
import {render} from 'react-dom'
import TagsEditor from 'react-tags-editor'
class App extends Component {
render () {
return (
<div>
<h1>React Tags Editor</h1>
<TagsEditor ref={c => { this.tagsEditor = c; }}/>
<button onClick={() => alert(this.tagsEditor.getTags())}>
Get Tags
</button>
</div>
)
}
}
render(<App />, document.querySelector('#app'))