It is necessary to filter the data by name, which contains the text written in the input.
For example, in an input I write ann and I get all the names containing this.
I get this error
How can I fix this and is there a function in firebase that searching in a string, not in an array?
const Search = () => {
const userList = collection(db, 'users');
const [result, setResult] = useState([]);
const searchUser = async(e) => {
let txt = e.target.value;
const items = await getDocs(query(userList, where('name', 'in', txt)));
await setResult(items.docs.map((doc) =>
({...doc.data()})
))
}
return <>
</>
}
export default Search;
Thank you.