Skip to content
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

The renderView prop gets called per the amount of views #53

Open
adi-doorloop opened this issue Jul 16, 2024 · 2 comments
Open

The renderView prop gets called per the amount of views #53

adi-doorloop opened this issue Jul 16, 2024 · 2 comments

Comments

@adi-doorloop
Copy link

I don't understand why it does this, it seems to cause unnecessary re-renders. Explain?

@jedwards1211
Copy link
Member

I could certainly memoize it more. It does need to get called any time the ViewProps for a given view change. So for example, when the active view is changed, it needs to get called for the previous active view (with active: false) and the next active view (with active: true). And the transitionState for both of the views goes through several changes during the transition process as well. I forget if transitionState can change on first mount, later I can check if react-transition-state does so to see if that causes any additional renders.

@jedwards1211
Copy link
Member

I'll think about an API you can use to opt out of calls to changes to ViewProps if you aren't using those props. Using react-view-slider/simple doesn't rerender as much, though I don't know if it's suitable for your use case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants