3
useEffect(() => {
    // Run query immediately 
    if (question && tableHash && Object.keys(tableHash).length > 0) {
        runQuery();
    }
}, [tableHash, question])

I have a useEffect clause that looks like this. However, I want it to run whenever BOTH tableHash and question change. Right now, it runs whenever one of them changes. Is there a way to set an AND dependency?

user6792790
  • 668
  • 1
  • 7
  • 22
  • 2
    Does this answer your question? [Run Effect hook only when both dependencies change](https://stackoverflow.com/questions/56881640/run-effect-hook-only-when-both-dependencies-change) – Evan Trimboli Jun 24 '21 at 03:14

0 Answers0