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

98
Visualizações
Convert CSS to React.js Style

I am using Elementor as a REST Api and I am getting bunch of strings in React side in this shape :

selector a {
    width: 189px;
    line-height: 29px;
}

Is there any library that can convert CSS with Pseudo to inline style in React? I tried to use https://www.npmjs.com/package/style-to-js library but it doesn't support brackets and Pseudo

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

0

So if what you want to do is apply this styles when you receive the response, you can do something like this with vanilla JS

var styleTxt=".container {background-color:grey;color:orange;width:100px;} footer {heigth: 50px;background-color:black} button {color:white; font-size: 15px; border: 1px solid white; background: transparent}"

setTimeout(()=>{
  var element = document.createElement('style');
  element.setAttribute('type', 'text/css');
  element.innerHTML = styleTxt;
  document.head.append(element);
}, 2000)
<div class="container">
  <span>Test for dinamic css</span>
  <footer>
    <button>Test</button>
  </footer>
</div>

styleTxt will be the response of the call.

I just put the timeout so you can see the before and after :)

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