Skip to content

Commit

Permalink
fix: added key prop to the recursive component
Browse files Browse the repository at this point in the history
  • Loading branch information
keyurparalkar committed Apr 15, 2024
1 parent 4121026 commit 09e4d2e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/components/ui/SchemaRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type SchemaRendererProps = {
const SchemaRenderer = (props: SchemaRendererProps) => {
const { schema, errors, register } = props;

return schema.fields.map((field) => {
return schema.fields.map((field, index) => {
if (field.type === "field") {
return (
<InputField
Expand All @@ -28,7 +28,12 @@ const SchemaRenderer = (props: SchemaRendererProps) => {
}

return (
<SchemaRenderer schema={field} errors={errors} register={register} />
<SchemaRenderer
key={`key-${field.type}-${index}`}
schema={field}
errors={errors}
register={register}
/>
);
});
};
Expand Down

0 comments on commit 09e4d2e

Please sign in to comment.