Aljullu / react-lazy-load-image-component

React Component to lazy load images and components using a HOC to track window scroll position.
https://www.npmjs.com/package/react-lazy-load-image-component
MIT License
1.46k stars 110 forks source link

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

Closed MikhailZakharov-dev closed 2 years ago

MikhailZakharov-dev commented 2 years ago

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