Skip to main content

Is it possible to retrieve ‘COMPONENT’ or ‘COMPONENT_SET’ nodes using a key from InstanceSwapPreferredValue?


declare type InstanceSwapPreferredValue = {
type: 'COMPONENT' | 'COMPONENT_SET'
key: string
}

I noticed the function importComponentByKeyAsync(key: string): Promise<ComponentNode>, but I believe it might not be the right approach for my goal.


I’d like to render a list of these components (their instances) if possible. It would be nice to have something fast-working.


Thank you in advance for your help!


That’s the right approach.



You need to import them by key, then export as images.


Thank you, Gleb! I will try 🙂


Update:



You need to import them by key



Looks like that function importComponentByKeyAsync is designed for published library components. I would like to operate with unpublished components in my file.



then export as images



Also, I would like to render them as instances, not images.


Trying to find a way, but don’t see any for now.