Skip to content

Commit

Permalink
Memoize form
Browse files Browse the repository at this point in the history
  • Loading branch information
sebelga committed Oct 27, 2020
1 parent 6c78fe2 commit 5294e05
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface Props {
onChange?: (state: FormState) => void;
}

export const RuntimeFieldForm = ({ defaultValue, onChange, docsBaseUri }: Props) => {
const RuntimeFieldFormComp = ({ defaultValue, onChange, docsBaseUri }: Props) => {
const { form } = useForm<RuntimeField>({ defaultValue, schema });
const { submit, isValid: isFormValid, isSubmitted } = form;

Expand Down Expand Up @@ -144,3 +144,5 @@ export const RuntimeFieldForm = ({ defaultValue, onChange, docsBaseUri }: Props)
</Form>
);
};

export const RuntimeFieldForm = React.memo(RuntimeFieldFormComp);

0 comments on commit 5294e05

Please sign in to comment.