mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-19 09:49:11 -05:00
21 lines
460 B
TypeScript
21 lines
460 B
TypeScript
import { useActionData } from "@remix-run/react";
|
|
|
|
export function FormErrors() {
|
|
const actionData = useActionData<{ errors?: string[] }>();
|
|
|
|
if (!actionData?.errors || actionData.errors.length === 0) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<div className="form-errors">
|
|
<h4>Following errors need to be fixed:</h4>
|
|
<ol>
|
|
{actionData.errors.map((error) => (
|
|
<li key={error}>{error}</li>
|
|
))}
|
|
</ol>
|
|
</div>
|
|
);
|
|
}
|