@nanlabs/react-ui
v0.4.9
Published
<!--lint disable double-link awesome-heading awesome-git-repo-age awesome-toc-->
Downloads
122
Readme
This library provides a set of React components that can be used in any React application.
Installation
npm install @nanlabs/react-ui
Usage
The following example shows how one of the multiple hooks provided by this library can be used.
In the example bellow we use the Image
component to render an image with a list of fallbacks and retrying on error.
You can find more examples in the documentation.
import React from "react";
import { Image } from "@nanlabs/react-ui";
const Component = () => (
<Image
src="https://picsum.photos/400"
fallback={["https://picsum.photos/300", "https://picsum.photos/200"]}
maxRetry={3}
retryDelay={1000}
initialTimeout={1000}
decoding="async"
loading="lazy"
className="async-image"
onLoad={() => console.log("Image loaded!")}
style={{
width: "300px",
objectFit: "cover",
}}
/>
);