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

157
Views
How to toggle the viewport of webpage using a button in react

Im trying to make my website change view from mobile to desktop view using a button in javascript

const handleClick = () => {

      const viewport = document.querySelector("meta[name=viewport]")
      viewport.setAttribute(
         "content",
         "width=200px, initial-scale=1.0, maximum-scale=2.0, user-scalable=0",
      )
}

I am using this code and it changes the viewport in html when I inspect using chrome but the screen is not changing

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I guess, you cant use document.queryselector directly in react js like we do in html, instead you have to use useRef and ref for accessing DOM elements.

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