I developed a react typescript application with react 16.9 and typescript 3.5.2.
It uses react state hooks like
const [hValue, setHValue] = useState();
type of the hValue
is IValue
So the setHValue
has return type React.Dispatch<any>
Then I updated the typescript version to 3.9.7 and it gives compilation errors and it seems that now the return type of setHValue
has changed to React.Dispatch<React.SetStateAction<undefined>>
Why is that? and how to resolve this issue?