Похожие чаты

I can send the code too. Why did this happen?

5 ответов

10 просмотров
12-Nothing Автор вопроса

export default function App() { const [count, setCount] = useState(0); function set() { setCount(count + 1); } function undo() { setCount(count === 0 ? 0 : count - 1); } function resetToZero() { setCount(0); } function handleChange(event) { setCount(event.target.value); } return ( <div className="App"> <div className="Add"> <input id="count" value={count} onChange={handleChange}></input> <button onClick={set}> Add To Cart </button> <button onClick={undo}>Remove</button> <button onClick={resetToZero}>Remove All</button> </div> </div> ); }

What is "this"? It doesn't seem as your page is refreshing.

12-Nothing Автор вопроса
Barkuni
What is "this"? It doesn't seem as your page is re...

After I change the value of the input box using my keyboard and then pressing add to cart the number is not incrementing. Instead 1's are appending towards the end of the number.

12-Nothing Автор вопроса
Barkuni
What is "this"? It doesn't seem as your page is re...

It happened due to some other button. I removed it

12 Nothing
After I change the value of the input box using my...

Because your keyboard input is taken as string, and adding a number to a string results in a string, unless otherwise specifically handled.

Похожие вопросы

Обсуждают сегодня

Hi everyone! I have a two-folded message to share today. First: updates and news, as we are being asked for those. We still want to go like we did the last 6 years: we w...
Marten | Unibright.io
24
generic procedure function test<T>(param: T); type case T of longint: NewT = word; longword: NewT = byte; end; var v1: NewT; Как это можно сделать? Чтобы у меня...
notme
21
Интересно, нет ли какого-то способа получить из dll не адрес самой метки, а адрес со смещением?
The Bird of Hermes
54
Guys, mexc or gate.io (only exchanges with the token I need, unfortunately): depositing xmr, not withdrawing, is safe rn, or can fall for shotgun kyc? (I heard gate is alread...
another one bites the dust
18
Whoa, did you guys see this FUNToken Seed Grant announcement? 💸
Noah Noure
37
Делал задачу вот такую https://stepik.org/lesson/4985/step/9?unit=1083 получилось такое https://play.haskell.org/saved/ipKrepqe оно работает, тестов много не писал, но работае...
Fedor
22
hello guys, I have a laptop, if you connect wired headphones, the sound will come from the headphones and the built-in speakers AT THE SAME TIME. How can I make the sound com...
El Pepe
21
hello, does someone have a good cheat sheet (max 2 sides of A4 paper sheet) for C only? I need it to cover most useful function for math, dynamic memory, strings, files (I/O),...
狐 - えんきどぅ
19
Всем привет, все время юзал бандлы, но появилась задача по базовому образу и команда werf build не пушит образ werf build --config='./root/werf.yaml' --repo ${CI_REGISTRY_IMAG...
Илья Корж
4
А можно как-нибудь включить default'ные настройки ядра?
Ari
26
Карта сайта