Releases: datocms/react-datocms
v7.0.1
SRCImage
className/style
is nowimgClassName/imgStyle
. IntroducepictureClassName/pictureStyle
. 0ef7657
v7.0.0
<Image>
pictureClassName/pictureStyle
props now control the<picture>
tag instead of the<img>
tag. For the<img>
tag, you can use the new propsimgClassName/imgStyle
. bcab174
v6.0.6
v6.0.5
- Fix TS errors on <StructuredText />
data
prop f17790d
v6.0.4
v6.0.3
- Fix regression on bgColor b93bfba
v6.0.2
v6.0.1
v6.0.0
Introducing server component
Now that both loading=lazy
and aspect-ratio
are broadly supported (> 93% of browsers) we can avoid complex JS to achieve lazy-loaded images with placeholders!
<SRCImage />
is a React Server Component, so it can be rendered and optionally cached on the server. It doesn't create any JS footprint. It generates a single <picture />
element and implements lazy-loading using the native loading="lazy"
attribute. The placeholder is set as the background to the image itself.
Be careful: the placeholder is not removed when the image loads, so it's not recommended to use this component if you anticipate that the image may have an alpha channel with transparencies.
Major changes to <Image />
component:
- removed
lazyLoad
prop: lazy loading is automatically disabled for images usingpriority
Other
All the examples have been consolidated into a single SPA React application to ensure a straightforward maintenance process: https://react-datocms-example.netlify.app/
v5.0.2
- Better types for toRemixMeta 9076c2d