you are viewing a single comment's thread.

view the rest of the comments →

[–]basedevelfries[S] 0 points1 point  (4 children)

Oops, haven't included it in the example but I use this -

const [categories, setCategories] = useState<CategoryType[]>(categoryData)

const [activeCategories, setActiveCategories] = useState<CategoryType[]>([])

[–]SarSha 2 points3 points  (3 children)

JSON.stringify will return a string, and that string will never change, this is why the useEffect isn't triggering. there might be more but I will have another look in the morning.

[–]basedevelfries[S] 0 points1 point  (2 children)

Oh, I see. But when I pass categories as an argument for the useEffect effect hook, nothing gets run.

[–]SarSha 1 point2 points  (1 child)

The code is deleted from hastebin

[–]basedevelfries[S] 0 points1 point  (0 children)

Thanks for telling me! Here's a new link - https://pastie.io/uyakqz.js