diff --git a/README.md b/README.md index 33c58a1..70e2719 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # use-lazyload-ref -[![npm version](https://badge.fury.io/js/use-lazyload-ref.svg)](https://badge.fury.io/js/use-lazyload-ref) ![CI Status](https://github.com/saitoeku3/use-lazyload-ref/workflows/Node%20CI/badge.svg) +[![GitHub license](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/saitoeku3/use-lazyload-ref/blob/master/LICENSE) [![npm version](https://badge.fury.io/js/use-lazyload-ref.svg)](https://badge.fury.io/js/use-lazyload-ref) ![CI Status](https://github.com/saitoeku3/use-lazyload-ref/workflows/Node%20CI/badge.svg) -> Custom hook to use lazy load easily +> Custom hook to use lazyload easily -## Install +## Installation ``` $ npm install use-lazyload-ref @@ -13,22 +13,44 @@ $ yarn add use-lazyload-ref ## Usage +To enable lazy loading, simply specify `ref` and `data-src` attributes. + ```jsx import React from 'react' import useLazyloadRef from 'use-lazyload-ref' const Component = ({ url }) => { - const [ref, isLoaded] = useLazyloadRef() + const [ref, hasLoaded] = useLazyloadRef() return ( - <> +