79183335

Date: 2024-11-13 03:36:11
Score: 0.5
Natty:
Report link

I ended up using a custom hook with useEffect(). It actually isn't so messy after all.

export const functions =  getFunctions(app);

export const useEmulator = () => {
    useEffect(() => {
        if (window?.location?.hostname === "localhost") {
            connectFunctionsEmulator(functions, '127.0.0.1', 5001)
        }
    }, [])
}
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: esafresa