我正在尝试在使用React.js构建的Web应用程序中使用Geofire。
我已经通过:安装了geofire,
npm install geofire
我的职能是:
const updateCoords = (lat,lng)=>{
var firebaseRef = firebase.database().ref("locations");
var geofireRef = new Geofire(firebaseRef);
geofireRef.set("user", [lat,lng]).then(function() {
console.log("User added to Geofire");
},
function(error) {
console.log("Error: " + error);
});
}
但是每次我调用它时,都会出现以下错误:
'Geofire' is not defined
任何解决方案?
P.S。 Firebase已安装]
我正在尝试在用React.js构建的Web应用程序中使用Geofire。我已经通过以下方式安装了geofire:npm install geofire我的功能是:const updateCoords =(lat,lng)=> {var ...
使用global variables时,所有window
都映射到create-react-app
对象>>
const geofire = new window.Geofire()