-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add events #18
Comments
@jcubic I don't use ReactJS, however if native vanilla javascript change event is implemented, is there anything more for ReactJS support? State could be updated via the onChange react handler. import { useRef, useState, useEffect } from 'react'
import tagger from '@jcubic/tagger'
function App() {
const [tags, setTags] = useState(null)
const inputRef = useRef(null)
// Write the Tagger code inside a useEffect hook
// It will run when the component is initially rendered
useEffect(() => {
// Define the Tagger options
const taggerOptions = {
allow_spaces: true,
}
// Initialize Tagger
tagger(inputRef.current, taggerOptions)
}, [])
return (
<div className='app'>
<input type='text' defaultValue='charles, louis, michel' ref={inputRef} onChange={e => setTags(e.target.value)} />
{tags && <pre>{tags}</pre>}
</div>
)
}
export default App |
Yea, you're right. I closed the PR too soon. I just wanted to have more events, but maybe they are not needed. I will checkout the PR locally add semicolons and merge. |
The PR got merged. I've changed the origin issue to only include the change event. |
Events are required for proper use in React to have proper binding.
The text was updated successfully, but these errors were encountered: