Skip to content

Commit cdfca25

Browse files
committed
refactor(CNavGroup): improve syntax
1 parent 5ce2e52 commit cdfca25

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/components/nav/CNavGroup.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,21 @@ export const CNavGroup = forwardRef<HTMLLIElement, CNavGroupProps>(
6666
}
6767

6868
const onEntering = () => {
69-
navItemsRef && navItemsRef.current && setHeight(navItemsRef.current.scrollHeight)
69+
navItemsRef.current && setHeight(navItemsRef.current.scrollHeight)
7070
}
7171

7272
const onEntered = () => {
7373
setHeight('auto')
7474
}
7575

7676
const onExit = () => {
77-
navItemsRef && navItemsRef.current && setHeight(navItemsRef.current.scrollHeight)
77+
navItemsRef.current && setHeight(navItemsRef.current.scrollHeight)
7878
}
7979

8080
const onExiting = () => {
8181
// @ts-expect-error reflow is necessary to get correct height of the element
8282
// eslint-disable-next-line @typescript-eslint/no-unused-vars
83-
const reflow = navItemsRef && navItemsRef.current && navItemsRef.current.offsetHeight
83+
const reflow = navItemsRef.current?.offsetHeight
8484
setHeight(0)
8585
}
8686

0 commit comments

Comments
 (0)