use-book

šŸ“ša hook that lets you get product info from url or book cover in React

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
use-book
331.0.03 years ago3 years agoMinified + gzip package size for use-book in KB

Readme

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

build passin license MIT npm 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

| Hook | Description | | ---------- | ------------------------------------------ | | useBook | get amazon data from url |

Performance pitfalls

URL
value| https://{HOST}/images/P/{ASIN/ISBN}.{COUNTRY}.{SIZE}
:-|:-
HOST | images-na.ssl-images-amazon.com or images-jp.amazon.com
ISBN | International Standard Book Number
ASIN | Amazon Standard Identification Number
COUNTRY|Japan:09
SIZE
value | mean | wh size | book size | notes
:-|:-|:-|:-|:-
THUMBZZZ | samnale | 75Ɨ75 | 52Ɨ75 |
TZZZZZZZ | small | 110Ɨ110 | 77Ɨ110 |
MZZZZZZZ | middle | 160Ɨ160 | 112Ɨ160 |
LZZZZZZZ | large | 500Ɨ500 | 349Ɨ500 | if h<500, return Full size image