I was wanting to implement &lt;<https://www.npmjs....
# react
j
I was wanting to implement <https://www.npmjs.com/package/react-progressive-graceful-image> into my project. I have ported over a few other libraries, but they all seem to be different. This one exports a class extending Component<Props,State> I've been used to using FC, and importing as a ComponentClass, but I'm not sure that is going to work here because of the Separate State? I didn't notice any examples in the wrappers github that lined up with this either. Would appreciate any advice, tysm.
t
State - private type in fact
What you need is:
Copy code
@file:JsModule("react-progressive-graceful-image")

external interface ProgressiveImageProps: Props {
   // ...
}
@JsName("default")
external val ProgressiveImage: ComponentClass<ProgressiveImageProps>
j
I was actually a bit more unclear on how I would use
{(src) => <img src={src} alt="an image" />}
in kotlin? as apart of the larger
Copy code
<ProgressiveImage src="large-image.jpg" placeholder="tiny-image.jpg">
  {(src) => <img src={src} alt="an image" />}
</ProgressiveImage>
Everything else is pretty clear, I assume this is the children? I'm a little unsure how to bring this over and use it since the
src
in the example I believe is a prop that switches between the passed
src
and
placeholder
in the original component.
t
It’s
chidren
signature
You can set function in
children
property
Copy code
children = { src -> ... }
j
Well that'll do it, talk about a brain fart. Thanks