Skip to content

How can i download the image? #84

Answered by vinothpandian
beurmuz asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @beurmuz,

Your React code looks good! The only issue with your code is that you have set the state using setDataURI and immediately accessed the dataURI state value. Setting state in react is an asynchronous and batched operation so you can't immediately access the value that you have set. So instead you can use the exportedDataURI variable to download the image. I made an example in the link below, you can use that. Let me know if you any more info!

https://codesandbox.io/s/nifty-gauss-zk8xtt?file=/src/App.js

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@beurmuz
Comment options

Answer selected by beurmuz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants