-
-
Notifications
You must be signed in to change notification settings - Fork 76
Open
Description
I'm trying to figure out how to just get the base64 string from my Barcode component. I can create the barcode on the page and if I copy the image location, I can see the actual base64 string that I want. https://codesandbox.io/s/determined-hawking-ow9mk
<Barcode value={'72527273070'} renderer={'img'} />
But how do I get that string in code? This is what I've tried:
const encodeSvg = reactElement => {
return (
'data:image/png;base64,' +
escape(ReactDOMServer.renderToStaticMarkup(reactElement))
);
};
const barcode = encodeSvg(
<Barcode value={'72527273070'} renderer={'img'} />
);
console.log(barcode);
Metadata
Metadata
Assignees
Labels
No labels