twobin / react-lazyload

Lazy load your component, image or anything matters the performance.
MIT License
5.85k stars 487 forks source link

Add support for a custom className #334

Closed AlexMeah closed 3 years ago

AlexMeah commented 3 years ago

Allow better styling and support for libraries like TailwindCSS by allowing the user to specify className.

It's not needed for the placeholder as you can already supply a custom component.

elodszopos commented 3 years ago

Please god yes, I came here exactly for this!

povilasbaranovas commented 3 years ago

Its really weird and restricting that you can pass class name prefix and not class name. Maybe i do not know something is there some reasoning behind it? Styled components is the most popular CSS in JS styling solution so far and this library does not have support for them until this PR will be merged. Yes you can add one more additional wrapper, but it should not be required imo.

More info on styled component reliance on class names here: https://styled-components.com/docs/advanced#existing-css

ameerthehacker commented 3 years ago

@AlexMeah @elodszopos @povilasbaranovas this has been released in v3.2.0, sorry for the delay.

spenweb commented 3 years ago

Does anyone know the release schedule for v3.2.0's corresponding @types/react-lazyload? I am currently //@ts-ignoreing the className attribute error in my .tsx file so that I can use v3.2.0. Thank you for the great package!