Skip to content

Commit

Permalink
fix: ref compose
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ committed Apr 28, 2022
1 parent 3cd0341 commit 344e2bb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ const Segmented = React.forwardRef<HTMLDivElement, SegmentedProps>(
} = props;

const containerRef = React.useRef<HTMLDivElement>(null);
const mergedRef = composeRef<HTMLDivElement>(containerRef, ref);
const mergedRef = React.useMemo(
() => composeRef<HTMLDivElement>(containerRef, ref),
[containerRef, ref],
);

const segmentedOptions = React.useMemo(() => {
return normalizeOptions(options);
Expand Down

0 comments on commit 344e2bb

Please sign in to comment.