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

144
Visualizações
When I am trying to use float values inside of a Text field in React the point or comma gets deleted

I have a table with some text fields and values. The values are already given. They are all whole numbers and I am trying to change one of them to a float using point or comma but when I use the comma or point they get deleted.

const DEFAULT_CHARGING_CURVE = [
 { SoC: 44, power: 250 },
 { SoC: 48, power: 240 },
 { SoC: 51, power: 220 },
 { SoC: 54, power: 200 },
 { SoC: 57, power: 180 },
 { SoC: 61, power: 170 },
 { SoC: 65, power: 160 },
 { SoC: 69, power: 155 },
 { SoC: 70, power: 145 },
 { SoC: 76, power: 115 },
 { SoC: 80, power: 80 },
 { SoC: 89, power: 60 },
 { SoC: 90, power: 55 },
 { SoC: 100, power: 0 },
];

const [chargingCurveTableData, setChargingCurveTableData] = useState(
DEFAULT_CHARGING_CURVE,

);

<TableCell className={classes.tableCell}>
                        <TextField
                          inputProps={{
                            'aria-label': `chargingCurveTable Row ${i}, power`,
                            style: { textAlign: 'center' },
                          }}
                          type='number'
                          value={row.power}
                          onChange={(event) => updateChargingCurveTableRowPower(
                            i,
                            event.target.value,
                          )
                          }
                        ></TextField>
                      </TableCell>
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

add to inputProps step value for precision

example:

const TestComponent = () => {  
  const [value, setValue] = useState(0)

  return (
      <TextField
        inputProps={{
          step: 0.1,
        }}
        variant="standard"
        label="test"
        value={value}
        type="number"
        onChange={(e) => {
          setValue(e.target.value)
        }}
      />
  )
}

I have this version "@mui/material": "^5.8.4"

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