Skip to main content

📚use-book

📚 use-book is a hook that lets you get product info from url or book cover in React.

build passin license MITnpm package twitter URL

Table of Contents

Install via npm

npm i use-book

Quick started

git clone github.com/tseijp/use-book
cd use-book
npm i
npm start

Simple example

import React from 'react'
import { useBook } from 'use-book'

export function App() {
const book = useBook('https://amazon.com/xxx/dp/xxx')
return <img {...book.img} />
}

Available hooks

HookDescription
useBookget amazon data from url

Performance pitfalls

URL

valuehttps://{HOST}/images/P/{ASIN/ISBN}.{COUNTRY}.{SIZE}
HOSTimages-na.ssl-images-amazon.com or images-jp.amazon.com
ISBNInternational Standard Book Number
ASINAmazon Standard Identification Number
COUNTRYJapan:09

SIZE

valuemeanw*h sizebook sizenotes
THUMBZZZsamnale75×7552×75
TZZZZZZZsmall110×11077×110
MZZZZZZZmiddle160×160112×160
LZZZZZZZlarge500×500349×500if h<500, return Full size image