Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

145
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda