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 ?