Is there a time lag with useState()..?

I have a function that updates the component’s state and then triggers another function that uses the updated state. The triggered function wasn’t “seeing” the updated state, so I decided to create an intermediary function (ugly, I know) . This works for one variable but not another.

What am I doing wrong? All the code can be found here but this is the basic gist:

Function A - updates state:

function callbackSetIngredients(ingredientChild) {

//A bunch of code that determines the new values

//Using those new values, I update state:


Function B - intermediary function:

function intermediateAfterAutoComplete() {
    console.log(selectedIngredients); //returns proper value
    console.log(selectedCategory); //returns nothing, not even "undefined"



Function C - function that needs the updated state:

//Uses the updated state to build DOM elements.