React Unsplash Image Fetcher
Unsplash Image Fetcher is a Node.js package designed for fetching and loading themed, high-resolution images from Unsplash. Ideal for applications needing dynamic, topical visual content.
- Easy Integration
- Simple Load Images
Todos
- Switch To .env File
- Create Hook to get Image
- Add More Options Like Resolution etc.
Usage/Examples
GetRelevantImage(theme: string)
This function fetches an image that is most relevant to the provided theme using Unsplash's API.
1
2
3
4
5
6
7
8
9
import { GetRelevantImage } from from "@danielgietmann/unsplashfetcher";
GetRelevantImage('nature')
.then(url => {
console.log("Image URL: ", url);
})
.catch(err => {
console.error(err);
});
GetLatestImage(theme: string)
This function fetches the latest image for a given theme using Unsplash's API.
1
2
3
4
5
6
7
8
9
import { GetLatestImage } from from "@danielgietmann/unsplashfetcher";
GetRelevantImage('nature')
.then(url => {
console.log("Image URL: ", url);
})
.catch(err => {
console.error(err);
});