'How do you use "useState" in Typescript?

How do I do something simple like this in Typescript?

const [text, setText] = useState("");

I'm getting a lot of errors, and I don't know how to fix them.

Parameter 'text' implicitly has an 'any' type.ts(7006)
Parameter 'setText' implicitly has an 'any' type.ts(7006)
'useState', which lacks return-type annotation, implicitly has an 'any' return type.ts(7010)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source