Javascript 加载一半数组/数据集,然后加载另一半

Javascript 加载一半数组/数据集,然后加载另一半,javascript,reactjs,Javascript,Reactjs,假设我有10篇文章 var文章=[{ “id”:“0”, “标题”:“第1条”, “图像”:http://placehold.it/300x250&text=image 1" { “id”:“1”, “标题”:“第2条”, “图像”:http://placehold.it/300x250&text=image 2" }, { “id”:“2”, “标题”:“第3条”, “图像”:http://placehold.it/300x250&text=image 3" }, { “id”:“3”, “

假设我有10篇文章

var文章=[{
“id”:“0”,
“标题”:“第1条”,
“图像”:http://placehold.it/300x250&text=image 1" {
“id”:“1”,
“标题”:“第2条”,
“图像”:http://placehold.it/300x250&text=image 2"
},
{
“id”:“2”,
“标题”:“第3条”,
“图像”:http://placehold.it/300x250&text=image 3"
},
{
“id”:“3”,
“标题”:“第4条”,
“图像”:http://placehold.it/300x250&text=image 4"
},
{
“id”:“4”,
“标题”:“第5条”,
“图像”:http://placehold.it/300x250&text=image 5"
},
{
“id”:“5”,
“标题”:“第6条”,
“图像”:http://placehold.it/300x250&text=image 6"
},
{
“id”:“6”,
“标题”:“第7条”,
“图像”:http://placehold.it/300x250&text=image 7"
},
{
“id”:“7”,
“标题”:“第8条”,
“图像”:http://placehold.it/300x250&text=image 8"
},
{
“id”:“8”,
“标题”:“第9条”,
“图像”:http://placehold.it/300x250&text=image 9"
},
{
“id”:“9”,
“标题”:“第10条”,
“图像”:http://placehold.it/300x250&text=image 10"
}

]
为什么不让一个变量跟踪上次加载的文章,然后使用for循环抓取五篇新文章?单击按钮+1@Binvention时,您可以使用状态变量跟踪分页。或者,如果您只需要连续交错加载数据,您可以在应用程序中启动计时器,以异步方式调用后端将获取数据并持续推送处于状态的新项。后端API可以返回每个请求中的最后一个项索引。计时器可以使用此信息来不断调用自身。一旦数据API不再返回任何行,计时器应停止。