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

fix(LazyLoadImage): SSR Warning: Prop style did not match #104

Merged

Conversation

MikhailZakharov-dev
Copy link
Contributor

@MikhailZakharov-dev MikhailZakharov-dev commented Jul 10, 2022

react doesn't apply style attributes with empty value (empty string) in
markup on server side and client side, but still make a strict comparison and try to find
background size and background image properties when hydrating client.
this is why someone might get these errors in their browser with react 18:

Warning: Prop style did not match. Server: "color:transparent;
display:inline-block;height:244;width:244" Client: "background-image:;
background-size:;color:transparent;display:inline-block;
height:244;width:244"

Fixes #105
removes unnecessary styles and error warning

react doesn't apply style attributes with empty value (empty string) in
markup, but still make a strict comparison and try to find
background size and background image properties when hydrating client.

Warning: Prop style did not match. Server: "color:transparent;
display:inline-block;height:244;width:244" Client: "background-image:;
background-size:;color:transparent;display:inline-block;
height:244;width:244"
Copy link
Owner

@Aljullu Aljullu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this contribution, @zakharovmikhail! Changes look good to me.

@Aljullu Aljullu merged commit 3bd514f into Aljullu:master Jul 17, 2022
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

Successfully merging this pull request may close these issues.

Warning: Prop style did not match.
2 participants