🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

use-unsplash

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-unsplash

> React hook to get a unsplash image and its metadata with ease.

beta
latest
Source
npmnpm
Version
0.0.1-2
Version published
Maintainers
1
Created
Source

useUnsplash - React hook

React hook to get a unsplash image and its metadata with ease.

Usage

yarn add @zeekrey/useunsplash
npm install @zeekrey/useunsplash

Basic usage:

const [image, imageMeta] = useUnsplash({
                apikey: '21jkwopdio29khp192',
                id: 'VMPhyAoVqqk',
                options: { w: 600, ar: '2:1', fit: 'crop' },
            }),

Details

This is the object thats needs to be provided when using the hook:

  • apikey: Your Unplash API key. If you don't have one, you can get it here: unsplash.com/developers
  • id: This is the image id. The is this: unsplash.com/photos/. For example https://unsplash.com/photos/jK2LuKGd_vI => id = jK2LuKGd_vI
  • options: Finde the most updated version here: unsplash.com/documentation

The hook returns an array with the following two parameters:

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Development

Run tests with

yarn test

To run tests you need to create env file like this:

cd <project-root> && echo process.env.APIKEY = 'your_api_key' > .env.js

License

MIT

FAQs

Package last updated on 20 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts