0.0.1-2 • Published 4 years ago

use-unsplash v0.0.1-2

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

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:

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