Hi,
I am trying to implement pagination/load more.
I have an api that gives me 20 results and a link that includes next 20 results.
I want to fetch the next 20 results and merge it to the initial state when I clicked on the load more button.
My questions are
- how can i merge the array called
hits
of two states ? the schema looks like this
const [state, setstate] =useState({
count:10000
from:1
hits:(20) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
to:20
_links:{next: {…}
}
- is this the right approach to implement load more functionality ?