I am studying applying type scripts to the reader toolkit.
These are my counter components.
An error occurred in
setInput(e.target.value) of the
The error is as follows:
Argument of type 'string' is not assignable to parameter of type 'SetStateAction'.ts(2345)
This means... The type of parameter in
string followed by
number cannot enter
How can I put the
number type in the
Help me Senior artists!
Loyalty Loyalty ^^ 7typescript react redux
With a very high probability,
typeof.target.value === 'string', the type script bounces.
Although HTML5 clearly has a number type input, it is essentially no different from normal input, and you should think of it as an additional option introduced for improved markup content and client implementation cosmetics. It would be nice to think of it as something like
input type="email". Today, most modern browsers offer quite a few additional features to email type input, but neither type scripts nor JS provide
input type="number" is actually not much different from this.
In that sense, you can just convert it and use it.
© 2022 pinfo. All rights reserved.