简体   繁体   中英

React-native throwing unexpected token error on import statement

React-native is throwing an unexpected token in a firebase import statement. I have been trying to fix this for a long time. I have already installed @react-native-firebase/auth with npm i install @react-native-firebase/auth . Please help. This is the error screenshot: 在此处输入图片说明

This is most probably happening because you cannot import as you did in your code.

As the documentation states for import :

The export parameters specify individual named exports, while the import * as name syntax imports all of them. Below are examples to clarify the syntax.

You need to put there an alias, if you need all of the exported objects from a library as the following:

import * as auth from '@react-native-firebase/auth';

I hope that helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM