1.0.29 • Published 5 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
5 years ago
1.0.28
5 years ago
1.0.27
5 years ago
1.0.26
5 years ago
1.0.25
5 years ago
1.0.24
5 years ago
1.0.23
5 years ago
1.0.22
5 years ago
1.0.21
6 years ago
1.0.20
6 years ago
1.0.18
6 years ago
1.0.17
6 years ago
1.0.16
6 years ago
1.0.15
6 years ago
1.0.14
6 years ago
1.0.13
6 years ago
1.0.12
6 years ago
1.0.11
6 years ago
1.0.9
6 years ago
1.0.7
6 years ago
1.0.6
6 years ago
1.0.5
6 years ago
1.0.4
6 years ago
1.0.3
6 years ago
1.0.2
6 years ago
1.0.1
6 years ago
1.0.0
6 years ago