Reputation: 1440
Simple question.
I've declared a string array using useMemo
and I'm struggling to get the correct flow type for it.
I have the following :
const fruits: () => Array<string> = useMemo(() => ['Apples', 'Oranges', 'Bananas'],[]);
and get the following flow error
Cannot assign useMemo(...) to fruits because array literal [1] is incompatible with function type [2].
Upvotes: 1
Views: 524
Reputation: 1440
Sorry, the following works. It's just as simple as using :
const fruits: Array<string> = useMemo(() => ['Apples', 'Oranges', 'Bananas']);
Upvotes: 1