Skip to content

Commit

Permalink
moving preventFormDefault function out of component
Browse files Browse the repository at this point in the history
  • Loading branch information
rayane-djouah committed Aug 21, 2023
1 parent e006ebb commit ec137d9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/components/SignInPageForm/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React, {useEffect, useRef} from 'react';
import FormElement from '../FormElement';

const preventFormDefault = (event) => {
// When enter is pressed form is submitted to action url (POST /).
// As we are using controlled component, we need to disable it here.
event.preventDefault();
};

function Form(props) {
const form = useRef(null);

const preventFormDefault = (event) => {
// When enter is pressed form is submitted to action url (POST /).
// As we are using controlled component, we need to disable it here.
event.preventDefault();
};

useEffect(() => {
const formCurrent = form.current;

Expand Down

0 comments on commit ec137d9

Please sign in to comment.