In React with typescript, I tried defining the useState type as an object with string key/value pairs. I couldn't find the answer so I thought I'd add it.
I've tried this <{ [key: string]: string }>>
and some similar variations, but haven't successfully cracked it yet.
P粉9738995672024-02-04 11:23:02
So this works -> useState<{ [key: string]: string }>
:-)
The best rubber duck ever! At least now it's here for everyone else