1.0.29 • Published 6 years ago
react-escalade-priceline v1.0.29
react-escalade-priceline
Dynamically fetch or prefetch Escalade stock & pricing.
Installation
With npm:
npm install --save react-escalade-priceline
With Yarn:
yarn add react-escalade-priceline
Usage
Fetching price and/or stock
import { Price, Stock, PriceAndStock } from 'react-escalade-priceline'
...
<Price site='goalrilla' id='b6101w'>
{({ price, loading }) => {
return (
<div>
{loading && 'Loading...'}
{!loading && price && `$${price.toFixed(2)}`}
</div>
)
}}
</Price>
...
<Stock site='goalrilla' id='b6101w'>
{({ stock, loading }) => {
return (
<div>
{loading && 'Loading...'}
{!loading && stock && 'In stock'}
{!loading && !stock && 'Out of stock'}
</div>
)
}}
</Stock>
...
<PriceAndStock site='goalrilla' id='b6101w'>
{({ stock, price, loading }) => {
if(loading) return <div>Loading...</div>
return (
<div>
<div>Price: {price}</div>
<div>Stock: {stock}</div>
</div>
)
}}
</PriceAndStock>
Prefetching price and/or stock
import { PrefetchPrice, PrefetchStock, PrefetchPriceAndStock } from 'react-escalade-priceline'
...
<PrefetchPrice site='goalrilla' id={['b6101w', 'b3101w' ]} />
...
<PrefetchStock site='goalrilla' id={['b6101w', 'b3101w' ]} />
...
<PrefetchPriceAndStock site='goalrilla' id={['b6101w', 'b3101w' ]} />
Switch to testing environment
import { PriceAndStock } from 'react-escalade-priceline'
<PriceAndStock site='goalrilla' id='b6101w' env="testing">
{({ stock, price, loading }) => {
if(loading) return <div>Loading...</div>
return (
<div>
<div>Price: {price}</div>
<div>Stock: {stock}</div>
</div>
)
}}
</PriceAndStock>
1.0.29
6 years ago
1.0.28
6 years ago
1.0.27
6 years ago
1.0.26
6 years ago
1.0.25
6 years ago
1.0.24
6 years ago
1.0.23
6 years ago
1.0.22
6 years ago
1.0.21
7 years ago
1.0.20
7 years ago
1.0.18
7 years ago
1.0.17
7 years ago
1.0.16
7 years ago
1.0.15
7 years ago
1.0.14
7 years ago
1.0.13
7 years ago
1.0.12
7 years ago
1.0.11
7 years ago
1.0.9
7 years ago
1.0.7
7 years ago
1.0.6
7 years ago
1.0.5
7 years ago
1.0.4
7 years ago
1.0.3
7 years ago
1.0.2
7 years ago
1.0.1
7 years ago
1.0.0
7 years ago