patch React compilation warnings and useEffect dependencies
This commit is contained in:
parent
4c7fa1512d
commit
2c5a0534d7
5 changed files with 8 additions and 12 deletions
|
@ -14,7 +14,6 @@ function App() {
|
|||
initState
|
||||
);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
const fetchIndexAPI = async () => {
|
||||
const response = await indexServices.indexService();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -37,7 +37,7 @@ const Home = props => {
|
|||
}
|
||||
}
|
||||
fetchRoomsAPI();
|
||||
}, [])
|
||||
}, [ dispatch ])
|
||||
|
||||
return (
|
||||
<div className="Home" data-testid="Home">
|
||||
|
|
|
@ -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 || [];
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
//@ flow
|
||||
|
||||
import type { state } from '../reducer';
|
||||
const socket = require('../../io');
|
||||
|
||||
export const initState = (): state => {
|
||||
return {
|
||||
|
|
Loading…
Reference in a new issue