You might not actually have a problem: State setting in React is asynchronous, so you can't console.log it on the next line and expect it to be updated. – Jayce444 (Stack Overflow)