我有一个页面,显示了许多组件在一个,组件获取数据,所以它使页面加载相当慢。
我想只显示前2个组件,当滚动到底部显示<Hotels />
,然后当滚动到底部的酒店,显示<Nightlife />
等。
这是我现在的页面:
'use client';
import { IPageProps } from '@/app/[city]/[lang]/page';
import React from 'react';
import ToVisit from './categories/ToVisit';
import Tops from './categories/Tops';
import Restaurants from './categories/Restaurants';
import Hotels from './categories/Hotels';
import Nightlife from './categories/Nightlife';
import Shopping from './categories/Shopping';
import Activities from './categories/Activities';
function CategoryPlaces({ params }: IPageProps) {
return (
<>
<Tops params={params} />
<Restaurants params={params} />
<Hotels params={params} />
<Nightlife params={params} />
<Shopping params={params} />
<Activities params={params} />
<ToVisit params={params} />
</>
);
}
export default CategoryPlaces;
字符串
如何在React中做到这一点?
1条答案
按热度按时间k2arahey1#
字符串