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

138
Visualizações
Why does react not load js script into page on mount?

I have a css file and a js file that imported into my react class like so:

import React from 'react'
import '../App.css'
import '../motion'

const Landing = () => {
    return (
        <div id="container">
            <div className="center">
                <h1 className="el-st">El Que Sabe Sabe</h1>
                {/* <span className="scroll">Scroll to shuffle</span> */}
            </div>
        </div>
    )
}

export default Landing

The animation only works when I remove the imported js file , re-add it and save the file leading me to believe the file is not being properly read when the component is mounted.

Is there a way to resolve this?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

If it works when you remove, re-add and then saving the files, that means that the state isn't updated per animation iteration.

I am not sure if you are using css animation, or js animation. But either or, i'd suggest implementing a simple useState statement somewhere. There really isn't enough information provided.

You can define something like:

const [animation, setAnimation] = useState(false);

And every time you want to play the animation, just call:

setAnimation(!animation);
about 4 years ago · Juan Pablo Isaza Relatório
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