我是我的应用程序,我有一个文件输入,用于提交文件并将其发送到firebase存储桶。我使用了react-hook-form库来完成这个任务。问题是,我想让上传的文件只有input元素,我不想有一个按钮来提交它。这一切都与风格有关,我可以做一个提交按钮,它肯定会工作。我看过一个视频,其中作者演示了如何创建此功能,甚至将其与firebase集成,但他有一个提交按钮 这是我的他是怎么做到的 import React from "react";
import { useForm } from "react-hook-form";
function App() {
创建一个react应用程序-- react-firebase-hook、firebase、react-hook-form、daisyUI --问题是,当我按submit按钮时,它在控制台中触发2次,在使用button时触发;Sign Up With Google会提前触发3times.Thanks。
在SingUP函数中:
import auth from '../../firebase.init';
import { useSignInWithGoogle } from 'react-firebase-hooks/auth';
import { useForm
我可能对firebase试图在这里做什么感到有点困惑。我可以让用户使用react中现有的firebase代码登录到我的站点,但是当我尝试访问该用户的用户名时(这样我就可以在屏幕上打印出来),我什么也得不到。
我的react应用程序的文件结构是加载Login.jsx的index.jsx。Login.jsx看起来像这样:
import React from 'react';
import axios from 'axios';
import * as firebase from 'firebase';
class Login extends
这一点以前曾有人问过,但我相信我的背景是不同的。我正在运行一个使用Create React App配置的使用--typescript标志运行的React应用程序。
我试着配置eslint、更漂亮、更沙哑来运行预编译脚本,结果就开始出错了。
我得到的错误是:'import' and 'export' may only appear at the top level,它与以下组件中的这一行相关:export default SignUp
import React from 'react'
import { Link, withRouter } fro
我已经在Firebase中安装了带有npm的Firebase,但是我不知道这个错误会发生什么。
文件FIREBASE.js
// Import the functions you need from the SDKs you need
import { initializeApp } from "firebase/app";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
我正在测试firebase云函数,我很好奇如何将数据从表单传递到云函数。我已经创建了一个接受几个字段的注册表单--我的计划是使用firebase创建一个auth帐户,并在创建auth帐户时运行一个云功能。此函数将在Firestore中创建一个用户文档。
下面的代码给出了我的前端设置的一个概念。
import React from "react"
import firebase from "firebase"
// create some config for firebase
const app = firebase.initializeApp(config
我正在创建一个登录组件,它将显示登录错误。但我不知道如何将errors数组从_onSubmit函数带到LoginForm
这是我的代码,密码。
import React, { Component } from 'react';
import Split from 'grommet/components/Split';
import Section from 'grommet/components/Section';
import Sidebar from 'grommet/components/Sidebar';
import L
首先,感谢你阅读这篇文章。
我正在按照一个教程,一步一步地学习如何使用react实现firebase。我的代码与教程完全匹配,该教程是针对教程作者的视频编写的。此外,一个名为signup.js的类似函数的结构也与此完全相同,并且不会抛出编译器错误。我实际上使用了signup.js文件来组织login.js文件,只进行了更新以反映不同的文件。
这是编译器中的错误吗?或者是我的代码中的某些东西导致了这种情况?
我会给解决这个问题的人买披萨。谢谢!
编译器错误
Failed to compile.
./src/pages/Login.js
Line 6:5: Parsing e
我正在学习React课程,在这个模块中,我正在学习如何将数据插入到Firebase数据库中,但我仍然坚持当前的课程,因为我的代码没有在数据库中插入数据,试图调试我发现的"cadastrar“函数没有被调用的问题。有人知道为什么它不在数据库中插入数据吗? 我没有得到任何错误,唯一的问题是我在输入字段中插入数据,然后单击按钮,但它没有插入数据到数据库中。 import React, { Component } from 'react';
import firebase from 'firebase'
export default class App ex
我有两个组件:包含数据列表的Root组件。从firebase中显示数据。第二个组件是一个DateRangepicker,它帮助选择日期,这样我们就可以筛选根的组件数据。 class Child extends React.Component {
pickDateRange = (e: React.FormEvent<HTMLFormElement>) => {
// getting data successufly from firebase
// this is where I get the error trying to set the
我正在使用React应用程序在formik表单提交时将一些信息存储到firebase/firestore中。当用户输入一个位置时,react-google-autocomplete将执行自动完成,然后返回格式正确的地址以及places.geometry.location纬度和经度。在提交时,我可以使用JSON.stringify控制日志或警报纬度和经度,但控制台返回一个firebase错误,说明如下:FirebaseError: Function addDoc() called with invalid data. Unsupported field value: a custom objec