I use the following code in my functional component. I want this component only to re-render when game._id changes. But React keeps giving me the warning:
React Hook useEffect has a missing dependency: 'game'. Either include it or remove the dependency array
Is this a dangerous practise or is it justified if I explicitly want it to depend on the given property?
  const [game, setGame] = useState({});
  useEffect(() => {
    return () => {
      if (game._id !== undefined) {
       // Do stuff with game
      }
    };
  }, [socket, user, game._id]);
I do not want to use game as a dependency, because that makes my component re-render way to much.
 
    