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

233
Views
How set dropdown value not change in localstorage after redirect or refresh in react js

My Issue was after dropdown value selected as tamil or hindi that value need to pass next Page. My Page translated into selected Language. I set in session and Local storage. But when it redirect to other page it turns into undefined in local storage. I share my page. This is first Page I select Tamil. enter image description here

And I select next page means It refresh and change into Undefined.

enter image description here

This is My function

handleChanges() {
  this.setState({ value: event.target.value });
  localStorage.setItem("myData", event.target.value);
  console.log("values", event.target.value);
  localStorage.getItem("myData");

  window.sessionStorage.setItem(
    "MyService.myObj",
    JSON.stringify(event.target.value)
  );

  let url =
    "http://XXXXXXXXXXYYYYYYYYZZZZ/Translate?values=OurStory,HowItWorks,Blog,Login,BeaParopakari,Welcome,Username,Password,ContactUs,TermsandConditions,SignUp,Forgotpassword?&lang=" +
    event.target.value;
  let user = JSON.parse(localStorage.getItem("user"));
  const accessToken = user;
  console.log(accessToken);
  fetch(url, {
    method: "GET",
    headers: {
      "Content-type": "application/json",
      Accept: "application/json",
      Authorization: "Bearer " + accessToken,
      "Access-Control-Allow-Headers": "Access-Control-Request-Headers ",
    },
  })
    .then((response) => response.json())
    .then((data) => {
      this.setState({
        Details: data,
      });
      console.log("Filter", data);
      const longArray = data;
      const size = 1;
    });
}

Please share your Knowledge. Thank you in Advance.

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!