the changePage function simply takes in a boolean of either true or false, if true the page state is incremented, and if false the page state is decremented.
there is no functional difference between adding a data type, this is just used so you can't predict the type of value used in the function later and to aid IntelliSense in your IDE. if a data type is not provided typescript will read it as a type of any which is okay.
Also with the useState() hook setPage() can either take in a number or a function that returns a number, which is what I used.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
the
changePage
function simply takes in a boolean of eithertrue
orfalse
, iftrue
the page state is incremented, and iffalse
the page state is decremented.there is no functional difference between adding a data type, this is just used so you can't predict the type of value used in the function later and to aid IntelliSense in your IDE. if a data type is not provided typescript will read it as a type of
any
which is okay.Also with the
useState()
hooksetPage()
can either take in a number or a function that returns a number, which is what I used.