score:1

Accepted answer
const Row = ({ index, style }) => (
  <div
    className={index % 2 === 0 ? "RowEven" : "RowOdd"}
    style={{
      ...style,
      top: `${parseFloat(style.top) + PADDING_SIZE}px`
    }}
  >
    item {index}
  </div>
);

const Example = () => (
  <List
    className="List"
    height={150}
    innerElementType={innerElementType}
    itemCount={51}
    itemSize={ITEM_SIZE}
    width={300}
  >
    {Row}
  </List>
);

const innerElementType = forwardRef(({ style, ...rest }, ref) => (
  <div
    ref={ref}
    style={{
      ...style,
      height: `${parseFloat(style.height) + PADDING_SIZE * 2}px`
    }}
    {...rest}
    className="innerClass"
  />
));

Related Query

More Query from same tag