Skip to content

Commit

Permalink
was missing in first upload
Browse files Browse the repository at this point in the history
  • Loading branch information
katayouny committed Apr 12, 2024
1 parent ab4d5fb commit 9c7609b
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { useContext } from "react";
import { userContext } from "./UserSection";

function UserSearchResult() {
const { query, loading, error, searchResult } = useContext(userContext);

return (
<div>
<h4>User Search Result</h4>

{loading && <div style={{color: "darkblue"}}>Loading...</div>}
{error && <div style={{color: "brown"}}>Error fetching data: {error}</div>}
{!loading && searchResult.length === 0 && <div style={{color: "brown"}}>No match found</div>}
{!loading && searchResult.length > 0 && (<ul>
{searchResult.map((result) => (
<li key={resultIndex}> {result.toLowerCase().includes({query}.toLowerCase())}</li>))}
</ul>)}
<br />
</div>
);
}

export default UserSearchResult;

0 comments on commit 9c7609b

Please sign in to comment.