'I need to make a filter in base of the data im featching

i want to make a input that filter the data that i am fetching. i am traing to make this but return an error

  const [search, setSearch] = useState(null);

  const filterPost = search ? data.filter(data.userId === search) : data;

  function handleChange(e) {
    setSearch(e.target.value);
  }

  const optimised = debounce(handleChange);

return (

      <div className="row d-flex justify-content-center my-4">
        <input
          className="border border-2 border-dark rounded w-25"
          type="text"
          placeholder="Set ID"
          onChange={optimised}
        />
      </div>

)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source