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

168
Views
Why this select tag not work right in react?

Code :

const Home = () => {
const location = useLocation();

const [lang, setLang] = useState((location.state === undefined)?"KorService":location.state.lang);


const tmp = (lang === "KorService")
    ? [//Kor Ver]
    : [//Eng Ver];

 ...

const selectLang = (e) => {
    setLang(e.target.value)
}
 ...

return (
    <div>
        <div className="header">
            <h1>{tmp[0]}</h1>
            <React.Fragment>
                <button className="lang" onClick={openModal}>Aa</button>
                <Modal open={modalOpen} close={closeModal} header={tmp[1]}>
                    <select className="langoption" onChange={selectLang}>
                        <option value="KorService">한국어</option>
                        <option value="EngService">English</option>
                    </select>
                </Modal>
            </React.Fragment>
        </div>
       ...
);

};

Result :

  • Opened Modal and clicked English option : Worked Well
  • When selecting the English option and selecting the Korea option with the modal window open : Worked Well
  • When lang is English, open modal clicked Korea : Not Worked

Want :

  • When user clicked any option, it operate immediately. I want to resolve this problem to selected Korea option well
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!