x3388638 / react-grid-carousel

React responsive carousel component w/ grid layout
https://react-grid-carousel.now.sh
MIT License
128 stars 28 forks source link

Add currentPage as Prop? #3

Open kylevalenzuela opened 3 years ago

kylevalenzuela commented 3 years ago

Is there any way to set currentPage as a prop? Since this is a functional component, you can't use refs. Thanks.

Pessi94 commented 3 years ago

I didn't find such a way, but I think that would be useful, right now re-render resets currentPage to 0. Also some way of accessing currentPage would be nice.

jonathan3692bf commented 3 years ago

Maybe an easy first step would just be allowing to set "page" as a property, and keeping that page as state in some higher-order component? Or @kylevalenzuela would you prefer also handlers for triggering next/previous pages too?

LanaIV commented 2 years ago

Is it possible to retrieve current page somehow? I need to trigger an analytics event when the page changes. I didn't find the way with the current version, but maybe there is a way I didn't find. If it's not managed, can I make a PR to add this behavior?