patch React compilation warnings and useEffect dependencies

This commit is contained in:
sorrelbri 2020-02-07 16:11:01 -08:00
parent 4c7fa1512d
commit 2c5a0534d7
5 changed files with 8 additions and 12 deletions

View file

@ -14,7 +14,6 @@ function App() {
initState
);
useEffect(() => {
const fetchIndexAPI = async () => {
const response = await indexServices.indexService();

View file

@ -24,7 +24,7 @@ const Game = (props) => {
}
}
fetchGameAPI();
}, [ gameId ])
}, [ gameId, dispatch ])
useEffect(() => {
@ -39,7 +39,7 @@ const Game = (props) => {
return dispatch(action);
}
roomSocketConnect();
}, [ state.active ] )
}, [ state.active , dispatch, state.user ] )
return (
<div

View file

@ -37,7 +37,7 @@ const Home = props => {
}
}
fetchRoomsAPI();
}, [])
}, [ dispatch ])
return (
<div className="Home" data-testid="Home">

View file

@ -1,8 +1,6 @@
import React, { useEffect, useState } from 'react';
import React, { useEffect } from 'react';
import { useParams } from 'react-router-dom';
import './Room.scss';
import socketIOClient from 'socket.io-client';
import config from '../../config';
import roomsServices from '../../services/api/roomsServices';
import GameButton from '../../components/Button/Game/Game';
import Message from '../../components/Display/Message/Message';
@ -29,7 +27,7 @@ const Room = (props) => {
}
}
fetchRoomAPI();
}, [ roomId ])
}, [ roomId, dispatch ])
useEffect(() => {
const roomSocketConnect = () => {
@ -41,7 +39,7 @@ const Room = (props) => {
dispatch(action)
}
roomSocketConnect();
}, [ roomId, state.user ])
}, [ roomId, state.user, dispatch ])
const renderGames = () => {
const games = state.games || [];

View file

@ -1,7 +1,6 @@
//@ flow
import type { state } from '../reducer';
const socket = require('../../io');
export const initState = (): state => {
return {