React is complaining about code below, saying it useState and useEffect are being called conditionally. The code work\'s fine without typescript:
import React