Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

132
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!