mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 02:59:04 +08:00
refactor(DirectoryTree): simplify code (#38184)
This commit is contained in:
parent
2a1f2836f4
commit
9d9447e54f
@ -52,10 +52,6 @@ const DirectoryTree: React.ForwardRefRenderFunction<RcTree, DirectoryTreeProps>
|
||||
|
||||
const cachedSelectedKeys = React.useRef<Key[]>();
|
||||
|
||||
const treeRef = React.createRef<RcTree>();
|
||||
|
||||
React.useImperativeHandle(ref, () => treeRef.current!);
|
||||
|
||||
const getInitExpandedKeys = () => {
|
||||
const { keyEntities } = convertDataToEntities(getTreeData(props));
|
||||
|
||||
@ -191,7 +187,7 @@ const DirectoryTree: React.ForwardRefRenderFunction<RcTree, DirectoryTreeProps>
|
||||
return (
|
||||
<Tree
|
||||
icon={getIcon}
|
||||
ref={treeRef}
|
||||
ref={ref}
|
||||
blockNode
|
||||
{...otherProps}
|
||||
showIcon={showIcon}
|
||||
|
Loading…
Reference in New Issue
Block a user