File tree Expand file tree Collapse file tree 2 files changed +18
-14
lines changed Expand file tree Collapse file tree 2 files changed +18
-14
lines changed Original file line number Diff line number Diff line change 1
- import React , { useEffect , useRef } from 'react' ;
1
+ import React , { useRef } from 'react' ;
2
2
3
3
import { bindActionCreators } from 'redux' ;
4
4
5
- import { useSelector , useDispatch , useState } from 'react-redux' ;
5
+ import { useSelector , useDispatch } from 'react-redux' ;
6
6
import classNames from 'classnames' ;
7
7
import { Console as ConsoleFeed } from 'console-feed' ;
8
8
import {
@@ -27,18 +27,7 @@ import DownArrowIcon from '../../../images/down-arrow.svg';
27
27
28
28
import * as IDEActions from '../../IDE/actions/ide' ;
29
29
import * as ConsoleActions from '../../IDE/actions/console' ;
30
-
31
- const useDidUpdate = ( callback , deps ) => {
32
- const hasMount = useRef ( false ) ;
33
-
34
- useEffect ( ( ) => {
35
- if ( hasMount . current ) {
36
- callback ( ) ;
37
- } else {
38
- hasMount . current = true ;
39
- }
40
- } , deps ) ;
41
- } ;
30
+ import { useDidUpdate } from '../../../utils/custom-hooks' ;
42
31
43
32
const getConsoleFeedStyle = ( theme , times , fontSize ) => {
44
33
const style = { } ;
Original file line number Diff line number Diff line change
1
+ import React , { useEffect , useRef } from 'react' ;
2
+
3
+ export const noop = ( ) => { } ;
4
+
5
+ export const useDidUpdate = ( callback , deps ) => {
6
+ const hasMount = useRef ( false ) ;
7
+
8
+ useEffect ( ( ) => {
9
+ if ( hasMount . current ) {
10
+ callback ( ) ;
11
+ } else {
12
+ hasMount . current = true ;
13
+ }
14
+ } , deps ) ;
15
+ } ;
You can’t perform that action at this time.
0 commit comments