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

274
Visualizações
After i fetch data and add it to redux my react app throws error a variable is not defined

After i fetch data and add it to redux my react app throws error: Uncaught TypeError: Cannot read properties of undefined (reading 'embed') at line 371. Here is line 371:

<input name="color" type="color" className="color-pick" id="embed_color" ref={embedColor} defaultValue={config.guild.welcomeConfig.embed.embedColor} />

Here is the fetch:

export const saveWelcomeConfig = (guildId, config ) => 
    axios({
        method: 'POST',
        url: url + `config/${guildId}/savewelcome`,
        data: {
            welcomeConfig: config
        },
        withCredentials: true
    })

And here is the action:

export const saveWelcomeConfig = (config, guildId) => async (dispatch) => {
    try{
        const { data } = await api.saveWelcomeConfig( guildId, config )

        
        dispatch({
            type: 'SAVE_WELCOME_CONFIG',
            payload: data
        })
    }catch(err){
        console.log(err)
    }
}

And the embed is in my redux's state. After i refresh page its working. But i dont want to refresh the page.

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