Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Função AdicionarTarefa não executa mesmo sendo convocada no <button>

    render(){
        return(
        <form className={style.novaTarefa}>
        <div>
        <label htmlFor="tarefa" className={style.label}>
            Adicione um novo estudo
        </label>
        <input 
            type="text" 
            placeholder="Estudo" 
            name="tarefa" 
            value = {this.state.tarefa}
            onChange = {evento => this.setState ({...this.state, tarefa: evento.target.value})}
            id="tarefa" 
            required 
            className={style.input}/>
        </div>

        <div>
        <label htmlFor="tempo" className={style.label}>
            Tempo
        </label>
        <input 
            type="time" 
            name="tempo" 
            value = {this.state.tempo}
            onChange = {evento => this.setState({...this.state, tempo: evento.target.value})}
            id="tempo" 
            min="00:00:00" 
            max="01:30:00"
            required 
            className={style.input}
            />
        </div>
        **<Botao type="submit" onClick={this.adicionarTarefa.bind(this)}>**
            Adicionar
        </Botao>

    </form>
    )
    }****
1 resposta
solução!

Boa tarde, tenta colocar no form a função assim: <form className={style.novaTarefa} onSubmit={this.adicionarTarefa.bind(this)}>

E no botão só com o type="submit", assim:

`<Botao type="submit">
        Adicionar
    </Botao>`

Acredito que como o "Botao" não tem uma prop chamada "onClick" vai dar erro no componente, Boa sorte!

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software