Fix lint errors
Manually fix all lint errors.
Some errors could not be fixed, a TODO comment was added.
To fix errors caused by `react-hooks/exhaustive-deps`, missing
dependencies were added to the dependencies array of some `useEffect`
calls.
We need to make sure that all `useEffect` call work as intended before
merging
Gitlab: #29
Change-Id: I939a99b0be53795ecc28d25b5067f037403f5e08
diff --git a/client/src/components/UsernameChooser.js b/client/src/components/UsernameChooser.js
index 57fa242..c1678b5 100644
--- a/client/src/components/UsernameChooser.js
+++ b/client/src/components/UsernameChooser.js
@@ -7,7 +7,7 @@
const isInputValid = (input) => input && input.length > 2;
-export default function UsernameChooser(props) {
+export default function UsernameChooser({ setName, ...props }) {
const [query, setQuery] = useState('');
const { isLoading, data, error } = usePromise(
@@ -23,10 +23,10 @@
useEffect(() => {
if (!isLoading) {
- if (error === 404) props.setName(query);
- else props.setName('');
+ if (error === 404) setName(query);
+ else setName('');
}
- }, [query, isLoading, data, error]);
+ }, [setName, query, isLoading, data, error]);
const handleChange = (event) => setQuery(event.target.value);