11import * as React from 'react' ;
2+ import { useState , useMemo , useCallback } from 'react' ;
23import classNames from 'classnames' ;
34import ResizeObserver from 'rc-resize-observer' ;
45import Item from './Item' ;
@@ -53,8 +54,8 @@ function Overflow<ItemType = any>(
5354 // Always use the max width to avoid blink
5455 const mergedRestWidth = Math . max ( prevRestWidth , restWidth ) ;
5556
56- const [ displayCount , setDisplayCount ] = React . useState ( 0 ) ;
57- const [ restReady , setRestReady ] = React . useState ( false ) ;
57+ const [ displayCount , setDisplayCount ] = useState ( 0 ) ;
58+ const [ restReady , setRestReady ] = useState ( false ) ;
5859
5960 const itemPrefixCls = `${ prefixCls } -item` ;
6061
@@ -66,7 +67,7 @@ function Overflow<ItemType = any>(
6667 */
6768 const showRest = isResponsive || data . length > maxCount ! ;
6869
69- const mergedData = React . useMemo ( ( ) => {
70+ const mergedData = useMemo ( ( ) => {
7071 let items = data ;
7172
7273 if ( isResponsive ) {
@@ -78,15 +79,15 @@ function Overflow<ItemType = any>(
7879 return items ;
7980 } , [ data , itemWidth , containerWidth , maxCount , isResponsive ] ) ;
8081
81- const omittedItems = React . useMemo ( ( ) => {
82+ const omittedItems = useMemo ( ( ) => {
8283 if ( isResponsive ) {
8384 return data . slice ( displayCount + 1 ) ;
8485 }
8586 return data . slice ( mergedData . length ) ;
8687 } , [ data , mergedData , isResponsive , displayCount ] ) ;
8788
8889 // ================================= Item =================================
89- const getKey = React . useCallback (
90+ const getKey = useCallback (
9091 ( item : ItemType , index : number ) => {
9192 if ( typeof itemKey === 'function' ) {
9293 return itemKey ( item ) ;
@@ -96,7 +97,7 @@ function Overflow<ItemType = any>(
9697 [ itemKey ] ,
9798 ) ;
9899
99- const mergedRenderItem = React . useCallback (
100+ const mergedRenderItem = useCallback (
100101 renderItem || ( ( item : ItemType ) => item ) ,
101102 [ renderItem ] ,
102103 ) ;
0 commit comments