🧹 remove needless imports
This commit is contained in:
parent
556c9d15fe
commit
24a26c16c2
2 changed files with 18 additions and 14 deletions
|
@ -1,8 +1,8 @@
|
||||||
import React, { useEffect, useRef } from 'react';
|
import React, { useRef } from 'react';
|
||||||
|
|
||||||
import { bindActionCreators } from 'redux';
|
import { bindActionCreators } from 'redux';
|
||||||
|
|
||||||
import { useSelector, useDispatch, useState } from 'react-redux';
|
import { useSelector, useDispatch } from 'react-redux';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { Console as ConsoleFeed } from 'console-feed';
|
import { Console as ConsoleFeed } from 'console-feed';
|
||||||
import {
|
import {
|
||||||
|
@ -27,18 +27,7 @@ import DownArrowIcon from '../../../images/down-arrow.svg';
|
||||||
|
|
||||||
import * as IDEActions from '../../IDE/actions/ide';
|
import * as IDEActions from '../../IDE/actions/ide';
|
||||||
import * as ConsoleActions from '../../IDE/actions/console';
|
import * as ConsoleActions from '../../IDE/actions/console';
|
||||||
|
import { useDidUpdate } from '../../../utils/custom-hooks';
|
||||||
const useDidUpdate = (callback, deps) => {
|
|
||||||
const hasMount = useRef(false);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (hasMount.current) {
|
|
||||||
callback();
|
|
||||||
} else {
|
|
||||||
hasMount.current = true;
|
|
||||||
}
|
|
||||||
}, deps);
|
|
||||||
};
|
|
||||||
|
|
||||||
const getConsoleFeedStyle = (theme, times, fontSize) => {
|
const getConsoleFeedStyle = (theme, times, fontSize) => {
|
||||||
const style = {};
|
const style = {};
|
||||||
|
|
15
client/utils/custom-hooks.js
Normal file
15
client/utils/custom-hooks.js
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import React, { useEffect, useRef } from 'react';
|
||||||
|
|
||||||
|
export const noop = () => {};
|
||||||
|
|
||||||
|
export const useDidUpdate = (callback, deps) => {
|
||||||
|
const hasMount = useRef(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (hasMount.current) {
|
||||||
|
callback();
|
||||||
|
} else {
|
||||||
|
hasMount.current = true;
|
||||||
|
}
|
||||||
|
}, deps);
|
||||||
|
};
|
Loading…
Reference in a new issue