jh-react-npm-example
v0.1.0
Published
``` import { ProductCard } from '../components' ```
Downloads
6
Readme
Primer paquete NPM, prueba prueba
import { ProductCard } from '../components'
<div>
<h1>Shoping</h1>
<div>
<ProductCard
product={product}
initialValue={{
count: 4,
maxCount: 10
}}
>
{() => (
<>
<ProductCard.Image />
<ProductCard.Title />
<ProductCard.Buttons />
</>
)}
</ProductCard>
</div>
<ProductCard
product={product}
initialValue={{
count: 4,
maxCount: 10
}}
>
{({ reset, isMaxCountReached, count, increaseBy }) => (
<>
<ProductCard.Image />
<ProductCard.Title />
<ProductCard.Buttons />
<button onClick={reset}>Reset</button>
<button onClick={() => increaseBy(-2)}>-2</button>
{!isMaxCountReached && (
<button onClick={() => increaseBy(2)}>+2</button>
)}
<span>{count}</span>
</>
)}
</ProductCard>
</div>