diff --git a/client/components/pages/signup.jsx b/client/components/pages/signup.jsx
index b4a369f..d9c8b58 100644
--- a/client/components/pages/signup.jsx
+++ b/client/components/pages/signup.jsx
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, { useRef } from 'react';
//utilities
const validateEmail = require('../../../common/utilities/validate-email.js');
@@ -8,7 +8,11 @@ const SignUp = props => {
//TODO: redirect if logged in
//refs
- let emailElement, usernameElement, passwordElement, retypeElement, contactElement;
+ const emailRef = useRef();
+ const usernameRef = useRef();
+ const passwordRef = useRef();
+ const retypeRef = useRef();
+ const contactRef = useRef();
return (
@@ -17,14 +21,14 @@ const SignUp = props => {
async evt => {
//on submit
evt.preventDefault();
- const [redirect, result] = await handleSubmit(emailElement.value, usernameElement.value, passwordElement.value, retypeElement.value, contactElement.checked);
+ const [redirect, result] = await handleSubmit(emailRef.current.value, usernameRef.current.value, passwordRef.current.value, retypeRef.current.value, contactRef.current.checked);
if (result) {
alert(result);
}
//cleanup & redirect
- emailElement.value = usernameElement.value = passwordElement.value = retypeElement.value = ''; //clear input
- contactElement.checked = false;
+ emailRef.current.value = usernameRef.current.value = passwordRef.current.value = retypeRef.current.value = ''; //clear input
+ contactRef.current.checked = false;
if (redirect) {
props.history.push('/');
@@ -33,27 +37,27 @@ const SignUp = props => {
}>
- emailElement = e} />
+
- usernameElement = e} />
+
- passwordElement = e} />
+
- retypeElement = e} />
+
- contactElement = e} />
+