Right now, pageSize
is defined and being used in PersonItems
(to set the items per page in a paginated list), which is inside PersonItemsWrapper
. But I also need pageSize
in PersonModal
(to jump to the last pagination page when a new person is added), which is inside PersonAddControls
.
<>
<PersonItemsWrapper /> // PersonItems is inside
<PersonAddControls /> // PersonModal is inside
</>
I could lift up the state and pass pageSize
as a prop … but that means I’d have to pass it down two components. So there are only two other options:
a. Store pageSize in a store (e.g. Zustard)
b. Store pageSize as an URL param (e.g. https://localhost:3000/persons?pageSize?=10?page=8)
What’s the usual way of doing this?