How can I make a map with a limit of 10 games?
const indexOfLastGameInList = currentPage * gameItemPerPage; const indexOfFirstGameInList = indexOfLastGameInList - gameItemPerPage; const currentGameList = results.slice( indexOfFirstGameInList, indexOfLastGameInList );
// then use map
{currentGameList.map((data) => {return <li>{data.xyz}</li>,}
I would like to know the same, I am looking for the option to bring a certain amount of elements. How can that be done?
I am trying to render in the DOM only 10 games of the more than 400 that are in the api… some APIs can be assigned something like freetogame.com/api/games?limits=10 or api/games?results=10 does this api have that option?
What you trying to do exactly?
加入讨论 - 在下面添加评论:
const indexOfLastGameInList = currentPage * gameItemPerPage;
const indexOfFirstGameInList = indexOfLastGameInList - gameItemPerPage;
const currentGameList = results.slice(
indexOfFirstGameInList,
indexOfLastGameInList
);
// then use map
{currentGameList.map((data) => {return <li>{data.xyz}</li>,}
I would like to know the same, I am looking for the option to bring a certain amount of elements. How can that be done?
I am trying to render in the DOM only 10 games of the more than 400 that are in the api…
some APIs can be assigned something like freetogame.com/api/games?limits=10 or api/games?results=10
does this api have that option?
What you trying to do exactly?