react-sketch icon indicating copy to clipboard operation
react-sketch copied to clipboard

I wanted to Export the value of SketchField

Open yadavendra15 opened this issue 4 years ago • 1 comments

Hi @tbolis,

Just wanted to know, Where can I get the value of the whiteboard after drawing.. something like exporting or is there any way to get the value of the SketchField whatever it stores.

I need a data on export like this file data.json.controlled.js have. So, that I can load that data at any time.. i.e., <SketchField width='1024px' height='768px' tool={Tools.Pencil} lineColor='black' lineWidth={3} value={something} /> Can you please help me in this.

Thanks in advance.

yadavendra15 avatar Oct 26 '21 13:10 yadavendra15

Try this:

<SketchField ref={sketchRef} />
...
const drawnObjects = sketchRef.current.toJSON()

huy-lv avatar Aug 11 '22 23:08 huy-lv