-
Notifications
You must be signed in to change notification settings - Fork 55
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
State Update Causes Re-Render #917
Comments
Faced the same issue. It's weird. My solution was to create a custom wrapper for and adding React.memo to it. That'll fix it. |
Set state will cause your component to re-render, by default we use To solve this, memoize your In case you need more control e.g. your custom deps-array |
I'm experiencing a related issue. I've memo-ized my However, in react strict mode (during development) I'm getting a re-render that's breaking the plyr component. We're currently using Any ideas on dealing with that? |
Hey @andyg5000, could you reproduce the issue in the code-sandbox, The react strict mode causes the use effects to be called twice and it is not controlled by us. |
Hey @realamirhe Thanks for following up. Here's a sample of what I'm seeing with https://codesandbox.io/s/hidden-shadow-ep3dnk?file=/src/App.js When you open the link, it may or may not load the video. If you save the app file without making any changes you'll see sometimes the video renders fine. Our main issue is that several things are causing the video component to get re-rendered occasionally (session hydration). When this happens things get doubled up (attached events). |
Describe the bug
When using the React state, any changes to the state (even if it's irrelevant to the player) cause the player to re-render.
Expected behavior
Change to state not relevant to the player should not cause a re-render.
Calling
this.setState({ something: 'else' })
will re-render the player.The text was updated successfully, but these errors were encountered: