mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
refactor: use react-use
simplify imports as tree shaking works
This commit is contained in:
parent
588940bed3
commit
58a63bc77b
4 changed files with 3 additions and 13 deletions
|
|
@ -7,11 +7,10 @@ import { connect } from 'driver/connect'
|
|||
import { FileExplorerCore } from 'driver/core'
|
||||
import { ConnectorState, Props } from 'driver/core/FileExplorer'
|
||||
import * as React from 'react'
|
||||
import useEvent from 'react-use/esm/useEvent'
|
||||
import { useEvent, usePrevious } from 'react-use'
|
||||
import { FixedSizeList as List, ListChildComponentProps, ListProps } from 'react-window'
|
||||
import { cx } from 'utils/cx'
|
||||
import { useOnLocationChange } from 'utils/hooks/useOnLocationChange'
|
||||
import { usePrevious } from 'utils/hooks/usePrevious'
|
||||
import { getCurrentPath } from 'utils/URLHelper'
|
||||
import { TreeNode, VisibleNodes } from 'utils/VisibleNodesGenerator'
|
||||
import { Icon } from './Icon'
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import { SideBarCore } from 'driver/core'
|
|||
import { ConnectorState, Props } from 'driver/core/SideBar'
|
||||
import { oauth } from 'env'
|
||||
import * as React from 'react'
|
||||
import useEvent from 'react-use/esm/useEvent'
|
||||
import { useEvent } from 'react-use'
|
||||
import { cx } from 'utils/cx'
|
||||
import * as DOMHelper from 'utils/DOMHelper'
|
||||
import { JSONRequest, parseURLSearch } from 'utils/general'
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import * as React from 'react'
|
||||
import useLocation from 'react-use/esm/useLocation'
|
||||
import { useLocation } from 'react-use'
|
||||
|
||||
export function useOnLocationChange(
|
||||
callback: React.EffectCallback,
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
import * as React from 'react'
|
||||
|
||||
export function usePrevious<T>(newValue: T) {
|
||||
const previousRef = React.useRef(newValue)
|
||||
React.useEffect(() => {
|
||||
previousRef.current = newValue
|
||||
})
|
||||
return previousRef.current
|
||||
}
|
||||
Loading…
Reference in a new issue