Skip to content

v1 RC

Latest
Compare
Choose a tag to compare
@fpapado fpapado released this 17 Jul 16:02
· 8 commits to master since this release

With this, I believe the library is ready for v1.
In the meantime, the Release Candidate (RC) versions will be under the 1.0.0-rc.x npm version.

Features:

Breaking:

  • Update to react-intersection-observer 6.x. This changes the API by requiring you to pass a {ref} prop to the component you are rendering. This is a bit verbose, but it allows you to drop the wrapping <div>! Should track this in the RC and see. I expect people to build their own components on top of LazyImage, so this shouldn't be a problem tbh.

  • Add a "props collection" for imageProps. A bunch of the img props are given to the parent just to be forwarded. To make this easier, the callbacks now take those props bundled as one object, which you can spread over the render callback.

The API now looks as such:

<LazyImage
  src="/img/porto_buildings_large.jpg"
  alt="Buildings with tiled exteriors, lit by the sunset."
  // Pick part of imageProps, forward ref
  placeholder={
    ({imageProps, ref}) =>
      <img ref={ref} src="/img/porto_buildings_lowres.jpg" alt={imageProps.alt} />
  }
  // Spread imageProps
  actual={
    ({imageProps}) =>
      <img {...imageProps} />
  }
/>

Internal:

  • microbundle has released their newer version, so we no longer need to use our own vendored one 🎉 This should make the repo more accessible to contributors.
  • add eslint. Debatable utility, but helps examples.
  • make Typescript stricter; Knowing when Typescript does not infer something is a bit more typing, but actually saves me headachese.
  • add Prettier as a devDep.
  • add pre-commit hooks for Prettier and eslint. Should make the repo more accessible to contributors.
  • update devDeps as appropriate.
  • update stories for new API.