Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from "react";
import { useState } from "react";
import "./App.css";

const App = () => {
Expand All @@ -10,15 +10,13 @@ const App = () => {
setError("");
setCount((prevCount) => prevCount + 1);
} else {
setError("Value Cannot be greater than 10");
setError("Value cannot be greater than 10");
}
};
const handleDec = () => {
if (count > 0) {
setError("");
setCount((prevCount) => prevCount - 1);
} else {
setError("Value Cannot be less than 0");
}
};
const handleReset = () => {
Expand All @@ -33,7 +31,7 @@ const App = () => {
Count :{" "}
<span
style={{
color: count >= 0 && count <= 6 ? "#000" : "red",
color: count >= 10 ? "red" : "#000",
}}
>
{" "}
Expand All @@ -43,7 +41,7 @@ const App = () => {
{error && <p className="error">{error}</p>}

<div>
<button className="btn inc" onClick={handleInc}>
<button className="btn inc" disabled={count === 10} onClick={handleInc}>
Inc
</button>
<button className="btn reset " onClick={handleReset}>
Expand Down