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

129
Visualizações
Why is {" "} automatically inserted in my React app?

I have a React application, and sometimes I see {" "} automatically being added in my source code. Can anyone help me understand why this is happening? It's not creating any error or bug in application, what's the reason behind it?

For example:

<div className="pr-form display-block">
  <input
    type="radio"
    name="same"
    onChange={handleChange("create")}
    defaultValue={values.create}
  />{" "}
  Create a new requirement
  <br />
  <input
    type="radio"
    name="same"
    onChange={handleChange("reuse")}
    defaultValue={values.reuse}
  />{" "}
  Reuse a draft
  <br />
  <input
    type="radio"
    name="same"
    onChange={handleChange("existing")}
    defaultValue={values.existing}
  />{" "}
  Using an existing requirement
</div>
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Probably you have plugin eslint-plugin-react installed so It automatically add curly braces to whitespace when file saved Alternatively, we can use &nbsp;(non-breaking spaces), <span> </span> or \u00A0 You can read more about this rule here rules/jsx-curly-brace-presence

Examples of correct code for this rule:

<Color text={"\u00a0"} />
<App>{"Hello \u00b7 world"}</App>;
<style type="text/css">{'.main { margin-top: 0; }'}</style>;
/**
 * there's no way to inject a whitespace into jsx without a container so this
 * will always be allowed.
 */
<App>{' '}</App>
<App>{'     '}</App>
<App>{/* comment */ <Bpp />}</App> // the comment makes the container necessary 
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