I am using context since props confuse me a lot and when I use it on a Click function both the setState function and fetch function run simultaneously and I get an error since the query is not passed in yet. I tried using setTimeout but
The onClick where it set the query and get fetchFunction
it didn't make a difference
enter image description here
context where I store most my state and function
also the context but the remaining part