JSPM

react-hook-previewer

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q22655F
  • License MIT

An image preview component based on React Hook.

Package Exports

  • react-hook-previewer

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-hook-previewer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-hook-previewer

An image preview component based on React Hook.

Install

Using npm

npm install react-hook-previewer --save-dev

Usage

ESM usage

import usePreviewer from 'react-hook-previewer'

const [previewer, openPreviewer] = usePreviewer()
return (
    <div>
        <img src={url} onClick={() => openPreviewer(url)}/>
        {previewer}
    </div>
)

Description

previewer => {React DOM Element} image previewer component.

openPreviewer(url)

  • url => {String} image url. If you want to open the previewer, you must pass a valid url.(required)

Tips

If you want to close the previewer, you can click anywhere on the screen.

License

react-hook-previewer is MIT licensed.