Skip to content

Commit

Permalink
-1 forwardRef
Browse files Browse the repository at this point in the history
  • Loading branch information
nstepien committed Dec 22, 2024
1 parent e6bc742 commit 8040416
Showing 1 changed file with 19 additions and 23 deletions.
42 changes: 19 additions & 23 deletions src/Cell.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { forwardRef, memo, type RefAttributes } from 'react';
import { memo, type RefAttributes } from 'react';
import { css } from '@linaria/core';

import { useRovingTabIndex } from './hooks';
Expand All @@ -25,26 +25,23 @@ const cellDraggedOver = css`

const cellDraggedOverClassname = `rdg-cell-dragged-over ${cellDraggedOver}`;

function Cell<R, SR>(
{
column,
colSpan,
isCellSelected,
isCopied,
isDraggedOver,
row,
rowIdx,
className,
onClick,
onDoubleClick,
onContextMenu,
onRowChange,
selectCell,
style,
...props
}: CellRendererProps<R, SR>,
ref: React.Ref<HTMLDivElement>
) {
function Cell<R, SR>({
column,
colSpan,
isCellSelected,
isCopied,
isDraggedOver,
row,
rowIdx,
className,
onClick,
onDoubleClick,
onContextMenu,
onRowChange,
selectCell,
style,
...props
}: CellRendererProps<R, SR>) {
const { tabIndex, childTabIndex, onFocus } = useRovingTabIndex(isCellSelected);

const { cellClass } = column;
Expand Down Expand Up @@ -101,7 +98,6 @@ function Cell<R, SR>(
aria-colspan={colSpan}
aria-selected={isCellSelected}
aria-readonly={!isEditable || undefined}
ref={ref}
tabIndex={tabIndex}
className={className}
style={{
Expand All @@ -126,7 +122,7 @@ function Cell<R, SR>(
);
}

const CellComponent = memo(forwardRef(Cell)) as <R, SR>(
const CellComponent = memo(Cell) as <R, SR>(
props: CellRendererProps<R, SR> & RefAttributes<HTMLDivElement>
) => React.JSX.Element;

Expand Down

0 comments on commit 8040416

Please sign in to comment.