I'm using snap-svg to display some SVG. I used this answer to do so in react.js.
However, I'd like to take it a step further: is it possible to load 2 svgs from urls, and then embed one inside of the other ?
So far, I managed to load my two SVGs, and then add them to my div, using this simple bit of code
const element = Snap(this.svgDiv)
Snap.load(url, function (baseProduct) {
if (element) {
element.add(baseProduct);
let designUrl = [my url]
Snap.load(designUrl, function (design) {
if (element) {
console.log(baseProduct);
baseProduct.select('rect').attr({fill: 'transparent'})
const image = design.select('image');
baseProduct.select('rect').add(image)
}
})
}
})
Unfortunately, this only displays the first image: the second one, which is supposed to be displayed inside of a rect,is not displayed. However, if I inspect my SVG, the img tac can be found inside of my rect. How comes so ?