Skip to content

Commit 7339757

Browse files
committed
fix: disable decrement button when count is zero
1 parent db67cde commit 7339757

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ReactByPrasadSir/src/components/00_tasks/04_contextApi/01_BasicCounter.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const BasicCounter = () => {
3232
<h1>1. Basic Counter App</h1>
3333
<h1 className='text-3xl'>{count}</h1>
3434
<div>
35-
<button onClick={decrement} className='border rounded-md text-white bg-blue-600 p-2 hover:bg-blue-700'>Decrement</button>
35+
<button onClick={decrement} disabled={count==0?true:false} className='border rounded-md text-white bg-blue-600 p-2 hover:bg-blue-700'>Decrement</button>
3636
<button onClick={reset} className='border rounded-md text-white bg-blue-600 p-2 hover:bg-blue-700 mx-5'>Reset</button>
3737
<button onClick={increment} className='border rounded-md text-white bg-blue-600 p-2 hover:bg-blue-700'>Increment</button>
3838
</div>

0 commit comments

Comments
 (0)