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

Rerenders all components #56

Open
JonasRothmann opened this issue Mar 29, 2022 · 4 comments
Open

Rerenders all components #56

JonasRothmann opened this issue Mar 29, 2022 · 4 comments

Comments

@JonasRothmann
Copy link

Is it a known issue/just a factor of React Contexts that all components using this library rerenders when a new library calls useModal?

@Quernest
Copy link
Owner

Quernest commented Apr 5, 2022

Is it a known issue/just a factor of React Contexts that all components using this library rerenders when a new library calls useModal?

Given that modal components with props are stored in the object in the Context - yes, any change in it causes the re-rendering of components dependent on this Context.

React is really very fast and it should not cause any noticeable problems, but I'll think about optimizing this stuff, I'm also open to suggestions :)

@JonasRothmann
Copy link
Author

It made me refetch a bunch of data when combining with Apollo Client, so I just seperated it into two contexts, one that just had showModal - this meant I never rerendered when state changed!

@Quernest
Copy link
Owner

Quernest commented Apr 8, 2022

It made me refetch a bunch of data when combining with Apollo Client, so I just seperated it into two contexts, one that just had showModal - this meant I never rerendered when state changed!

If you don't mind, could you send me an example?

@kytosai
Copy link

kytosai commented Apr 24, 2023

It made me refetch a bunch of data when combining with Apollo Client, so I just seperated it into two contexts, one that just had showModal - this meant I never rerendered when state changed!

You can share example ?

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

3 participants