New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested <Fancybox> React components - allowed or antipattern? #218
Comments
You are welcome to write your own React component, this - https://fancyapps.com/docs/ui/fancybox/react - is just an example. |
I used code from example, but my question is another: it allowed to nest created components or not? |
Fancybox is not adding event listeners directly to the elements. It creates one global click event listener and reuses it for every binding. Therefore it works for all elements created in the future. Basically, |
I have problems with my project when I have multiple instances like this Behavior in codesandbox - event subscription in the last instance fired 3 times (if you open another instance, for example - click to gallery). How to find a workaround for this? I need event subscription at component level, not at the page or at the layout level. |
Sorry, I haven't found the time to build more advanced React component yet. Anyway, you can always create your own click handler and start Fancybox using |
I'd love for you to take the time to go through some basic React use cases with variations of options in different parts of the code within the same page. |
Hi.
I create a React component Fancybox
And inside root of my app I just wrapped it in this component
And, later, inside one of my sections I want to bind some spefific options for a gallery.
It is allowed to make another
<Fancybox options={{..}} >
inside first global one?Purpose of global one is to global control all modals / triggers of the app, that have not required some specific options on instance.
The text was updated successfully, but these errors were encountered: