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

70
Views
Copy array of data to clipboard

I have a Flask back-end and a React front-end. At some point data is sent from back-end to front-end where the data is used for several things. Either way, when the data comes from the back-end to the front-end I just save it as follows when the page loads:

const [data, setData] = useState[]

useEffect(() => {
    setData(<data from backend>);
}, []);

Hence, my data should now be stored as data. And data here is just an array of numbers/values. Now I would like to just click a button or something, and then copy the data to the clipboard, where I can then paste it into Excel or something.

I just can't seem to find any good solution to this. So I was wondering how this is done, and if it is even possible without writing 100 lines of code ?

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

0

You can set the clipboard text with :

navigator.clipboard.writeText(data)

and you can set onClick event or set that in defined useEffact hook after fetching data.

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!