Неожиданно во время бега. Я пытаюсь загрузить InfiniteLoader реагировать виртуализированными. Хотелось бы узнать, как вызвать API через этот компонент, если какой-либо пример доступен. Я взял компонент от https://github.com/bvaughn/react-virtualized/blob/master/docs/InfiniteLoader.md
Я использую пример из https://bvaughn.github.io/react-virtualized/#/components/InfiniteLoader
import React from 'react';
import ReactDOM from 'react-dom';
import { InfiniteLoader, List } from 'react-virtualized';
import 'react-virtualized/styles.css'; // only needs to be imported once
export default class MyList extends React.PureComponent {
const remoteRowCount
const list = [];
function isRowLoaded ({ index }) {
return !!list[index];
}
function loadMoreRows ({ startIndex, stopIndex }) {
}
function rowRenderer ({ key, index, style}) {
return (
<div
key={key}
style={style}
>
{list[index]}
</div>
)
}
//Render the list from this function
render() {
return(
<InfiniteLoader
isRowLoaded={isRowLoaded}
loadMoreRows={loadMoreRows}
rowCount={remoteRowCount}
>
{({ onRowsRendered, registerChild }) => (
<List
height={200}
onRowsRendered={onRowsRendered}
ref={registerChild}
rowCount={remoteRowCount}
rowHeight={20}
rowRenderer={rowRenderer}
width={300}
/>
)}
</InfiniteLoader>
);
}
}
Получение приведенного ниже исключения
Module build failed: SyntaxError: D:/code/react-starter/src/Components/MyList/MyList.js: Unexpected token (8:8)
6 | export default class MyList extends React.PureComponent {
7 |
> 8 | const remoteRowCount
| ^
9 |
10 | const list = [];
11 |