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

134
Vistas
Conditionally rendering suffix of currency-input-field package's currencyInput component using onFocus and onBlur, but its working only for first time

Added state for focus on input, once it is focused, i want $ sign to disappear, I used onFocus and onBlur events to set the states to render the suffix of accounting Box conditionally, it is only working for the very first time when page renders, after that its not working

import React, { useState } from "react";
import CurrencyInput from "react-currency-input-field";
import "./index.scss";

const AccountingBox = ({
  conversion,
  characterLimit,
  characterDecimalLimit,
}) => {


  const [isFocused, setIsFocused] = useState(false);
  return (
    <React.Fragment>
      <CurrencyInput
        className="form-control col-lg-4"
        id="input-example"
        name="input-name"
        placeholder="Please enter a value"
        defaultValue={5}
        decimalsLimit={characterDecimalLimit}
        groupSeparator={conversion && "."}
        decimalSeparator={conversion && ","}
        maxLength={characterLimit}
        suffix={isFocused === false ? "$" : null}
        onFocus={() => setIsFocused(true)}
        onBlur={() => setIsFocused(false)}
      />
    </React.Fragment>
  );
};

export default AccountingBox;

about 4 years ago · Juan Pablo Isaza
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