Closed fredmanxu closed 1 year ago
I tried this example, But inputRef is null.
import { MentionsInput, Mention } from 'react-mentions'; export default function MyInputBox() { const [inputValue, setInputValue] = useState('') let inputRef = React.createRef() return ( <div> <MentionsInput inputRef={inputRef} value={inputValue} a11ySuggestionsListLabel={"Suggested mentions"} > <Mention trigger="@" data={[]} renderSuggestion={null} /> </MentionsInput> <button onClick={()=>{ inputRef.current.focus() }}> focus programmatic </button> </div> ) }
"react": "^18.2.0", "react-mentions": "^4.4.7",
I tried this example, But inputRef is null.
My example code
package.json