I'm using the moviedb api to make an app and i'm having some trouble updating state inside a ternary operator. If i run the following code to check if everything is working there are no problems
{(match.params.id === iteminfo[0]) ? console.log("match") : console.log("nomatch")}
If the id and iteminfo match , i get match , if they don't i get "nomatch"
when i try and update the state like this
{(match.params.id === iteminfo[0]) ? setRemove(true) : console.log("nomatch")}
I get the following error
Is there a way to update the state so it doesn't form this loop?