Skip to content

use[FIREBASEPRODUCT]Emulator conflicts with react hooks #4930

@codesby

Description

@codesby

[REQUIRED] Describe your environment

  • Operating System version: Windows 10 Home 21H1
  • Browser version: Microsoft Edge Version 90.0.818.62 (Official build) (64-bit)
  • Firebase SDK version:^9.0.0-beta.1
  • Firebase Product: _____ (storage, firestore)

[REQUIRED] Describe the problem

Can't use the naming convention useSomethingEmulator with react it throws a
error React Hook "useFirestoreEmulator" cannot be called at the top level. React Hooks must be called in a
React function component or a custom React Hook function react-hooks/rules-of-hooks

Steps to reproduce:

Attempting to use any emulator suite within a react app

Relevant Code:

// TODO(you): code here to reproduce the problem
useFirestoreEmulator(getFirestore(), "localhost", 8080)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions