React with typescript defining useState type as an object with string key/value pairs
P粉014293738
P粉014293738 2024-02-03 17:48:59
0
1
460

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粉014293738
P粉014293738

reply all(1)
P粉973899567

So this works -> useState<{ [key: string]: string }> :-)

The best rubber duck ever! At least now it's here for everyone else

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template