Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

151
Visualizações
React form not submitting to google sheet

I'm trying to submit an email in the input form field and have it post to my Google sheet as the backend. I'm using sheetdb.io to handle this and have used their Javascript example in my react handleSubmit function. For some reason the email is not posting to google sheets.

Can someone let me know what I'm doing wrong?

import './Hero.css'
import prlearn_logo from '../assets/prlearn_logo.png'
import { useState } from 'react'


function Hero(){

    //managing state of input field
    const [input, setInput] = useState('')

    const handleSubmit = (e) => {
        e.preventDefault()

        fetch('https://sheetdb.io/api/v1/1k4utfd19hypz')
            .then(response => response.json())
            .then(data => {
                console.log(data);
            })
            .catch(error => {
                console.error(error);
            });
    }

    return (
        <div className="container">
            <div className="heading">
                <img className ="logo" src={prlearn_logo} alt="prlearn_logo" />
                <h1 className="h1">Learn Spanish from native speakers and support the local community.
                <br/> 
                <span>Feel at home by removing the language barrier.</span>
                </h1>
            </div>
            <div className="waitlist">
                <form onSubmit={handleSubmit}>
                    <input 
                        type="text"
                        className="input-field"
                        placeholder="Enter email address"
                        name="e-mail"
                        required
                        value={input}
                        //changes input in state function
                        onChange={(e) => setInput(e.target.value)}
                    />
                    <button type="submit" className="button">Join The Waitlist</button>
                </form>
            </div>  
        </div>
    )
}

export default Hero
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda