Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 1846

Typing a useState

$
0
0

There’s a few different ways to approach it, but the simplest in your example would be to type the return type of the useState function:

let (user, setUser) = React.useState((_): loadable<user, 'a> => Loading)

Viewing all articles
Browse latest Browse all 1846

Trending Articles