score:1
Accepted answer
If you are using the Modular SDK v9.0.0
then try refactoring your code like this:
import { initializeApp } from "firebase/app"
import { getAuth, onAuthStateChanged } from "firebase/auth"
const app = initializeApp(app)
const auth = getAuth(app)
const authListener = () => {
onAuthStateChanged(auth, (user) => {
if (user) {
console.log(user)
}
})
}
If you want to use the older namespaced syntax (firebase.auth()
) then change your imports to compat version:
import firebase from "firebase/comapt/app"
import "firebase/compat/auth"
You can read more about upgrading to modular SDK in the documentation.
Source: stackoverflow.com
Related Query
- TypeError: Webpack imported module is not a function
- Importing React as default module not working inside Symfony Webpack Encore project
- RollupJS ES6 module can't get imported because of default not found for redux and redux-form
- Module build failed: TypeError: template is not a function using webpack
- Module not found: Error: Can't resolve 'crypto', webpack < 5 used to include polyfills for node.js core modules by default
- Imported module default.register is not a function
- TypeError dispatcher.useState is not a function when using React Hooks
- Webpack + React + TypeScript: Module not found ... in ... node_modules/react/
- Failed to compile. webpack is not a function
- How to fix TypeError is not a function (testing promises with Jest)
- Webpack module federation is not working with eager shared libs
- React TypeError this._test is not a function
- React Webpack - Error: Module is not a loader (must have normal or pitch function)
- How to fix TypeError _interopRequireDefault is not a function in Create React App
- Webpack Dev Server (webpack-dev-server) Hot Module Replacement (HMR) Not Working
- When using ES6, how can an imported function be undefined in one file, and not in another?
- export default arrow function cannot be imported
- Heroku "content not from webpack is served from /app/public" despite using all default create-react-app config
- Webpack - TypeError: $ is not a function
- Webpack 5 module federation - hooks in remote module - not working
- REACT Uncaught TypeError .then is not a function
- does not contain a default export even after being correctly imported in React
- webpack-cli TypeError cli.isValidationError is not a function
- There is TypeError (0 , _ColorReducer.color) is not a function error in React + Redux code
- Module not found: Error: Cannot resolve module 'react' when I use webpack
- Webpack - Uncaught TypeError: (0 , _reactDom2.default) is not a function
- Error in Entry Module not found - in Webpack Config file
- Uncaught TypeError: Object(...) is not a function with React, Formik and Webpack
- Webpack + `create-react-app` | ProvidePlugin Not Loading React as a Module
- TypeError this.props.addNode is not a function
More Query from same tag
- Reusing a react application inside angularjs application
- How can I cancel re-render view if view is in Route on React with react-router-dom
- React-Scroll - Link not working - appears as empty <a> tag in html
- Solidity crowdsale function fails on my web page but is successful when sent directly but doesn't send ERC20 on successful transaction
- Mapping within a map in ReactJS
- Expose Loader does not export module globally
- How can I display a set of array on click of a button from it's child component using React
- How to pass string into react-router-dom Route as function?
- set min width on <td> in a reactstrap Table
- Login is not a function after logging out then trying to log back in
- Rendering root as null (rendering in DOMless scope)
- Why is it not reading the params?
- React: Create Elements/Tags programmatically / Create React Element from String?
- Call Method Or Iterate over Array in HTML with JSX
- How does React.useState triggers re-render?
- I can't show the results of search in my movies library app doing by reactjs
- Fetching 'title' from WP REST API with React
- Html Put a fixed text on an Redux Form Field
- React conditional classnames using template strings and && operator
- Why does Axios get call return a 404 error with basic setup?
- Button refreshes page, and UseEffect not working
- How to import PDF file with react-file-viewer in Next.js?
- socket emits multiple times to same client socketio
- Jest test error: ...subscribe is not a function
- Using tab key to move focus from data grid to next page element
- Pass mouse event to elements below HTML
- React and wrappers for plotly.js charting
- Render components for all routes except one specific route
- React DevTools show very big background when moving cursor to a react component
- loading json data from local file into React JS