Search code examples
javascriptreactjssemantic-ui

React Semantic UI Search component only accepts one character at a time (which also eliminates the previous input)


I am using search component from Semantic UI. When I console.log what I typed in the search field, only a single character is printed ('abcd' will be printed as 'a', 'b', 'c', 'd') and the search field doesn't show any character as if it doesn't take any input. But If I used <Input> </Input> instead, these problems are gone.
code sample is here


Solution

  • This works as intended. Did you forget to actually set state?

    const handleSearchChange = useCallback((e, data) => {
        setValue(data.value);
        setLoading(!loading);
      }, []);