Hello folks,
I need to replace all component instances on my page to components from library. I try using the function swapComponent but I don’t know if it is the right path. Here is my code:
const old_com = figma.root.findOne(node => node.type == "INSTANCE" && node.name == "Icon") as InstanceNode;
let new_com = await figma.importComponentByKeyAsync("7c5dd1fbdbd83b87ac6d7XXX");
old_com.swapComponent(new_com)
Nothing happens after starting my code.
Thanks