"ReferenceError: string is not defined" in React useState with flowjs

889 views Asked by At

I'm trying to annotate useState(null) with flow but getting the error ReferenceError: string is not defined.

I'm doing something like:

const [imageUrl, setImageUrl] = useState<string | null>(null)

thanks in advance

1

There are 1 answers

4
Guerric P On

The useState<string | null> is a TypeScript syntax. If you're not using TypeScript just use useState(null)