MCPcopy Create free account
hub / github.com/TanStack/virtual / App

Function App

examples/react/dynamic/src/main.tsx:397–454  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

395}
396
397function App() {
398 const pathname = location.pathname
399 return (
400 <div>
401 <p>
402 These components are using <strong>dynamic</strong> sizes. This means
403 that each element's exact dimensions are unknown when rendered. An
404 estimated dimension is used to get an a initial measurement, then this
405 measurement is readjusted on the fly as each element is rendered.
406 </p>
407 <nav>
408 <ul>
409 <li>
410 <a href="/">List</a>
411 </li>
412 <li>
413 <a href="/window-list">List - window as scroller</a>
414 </li>
415 <li>
416 <a href="/columns">Column</a>
417 </li>
418 <li>
419 <a href="/grid">Grid</a>
420 </li>
421 <li>
422 <a href="/experimental">Experimental</a>
423 </li>
424 </ul>
425 </nav>
426 {(() => {
427 switch (pathname) {
428 case '/':
429 return <RowVirtualizerDynamic />
430 case '/columns':
431 return <ColumnVirtualizerDynamic />
432 case '/grid': {
433 const columns = generateColumns(30)
434 const data = generateData(columns)
435 return <GridVirtualizerDynamic columns={columns} data={data} />
436 }
437 case '/experimental':
438 return <RowVirtualizerExperimental />
439 default:
440 return <div>Not found</div>
441 }
442 })()}
443 <br />
444 <br />
445 {process.env.NODE_ENV === 'development' ? (
446 <p>
447 <strong>Notice:</strong> You are currently running React in
448 development mode. Rendering performance will be slightly degraded
449 until this application is build for production.
450 </p>
451 ) : null}
452 </div>
453 )
454}

Callers

nothing calls this directly

Calls 2

generateColumnsFunction · 0.70
generateDataFunction · 0.70

Tested by

no test coverage detected