Skip to content

Commit

Permalink
Prevent form refresh if user presses Enter key during filtering process
Browse files Browse the repository at this point in the history
  • Loading branch information
zahrafalak committed Sep 1, 2024
1 parent 959c10a commit 243b675
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/FilterListInput.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeEvent } from "react";
import { ChangeEvent, FormEvent } from "react";

interface FilterListProps {
searchTerm: string;
Expand All @@ -13,8 +13,12 @@ export function FilterListInput({
setSearchTerm(e.target.value);
};

const handleSubmit = (e: FormEvent<HTMLFormElement>) => {
e.preventDefault();
};

return (
<form>
<form onSubmit={handleSubmit}>
<label htmlFor="filterList">
Filter List:
<input
Expand Down

0 comments on commit 243b675

Please sign in to comment.