Skip to content

How Can I get All Nodes' refs(instance)? #1518

Answered by bcakmakoglu
yczkhx-ths asked this question in Q&A
Discussion options

You must be logged in to vote

You can store refs in an array or a map.

const myRefs = ref(new Map())

const nodeTypes = {
	custom: (nodeProps) => h(MyNode, { ...nodeProps, ref: (nodeRef) => myRefs.value.add(nodeProps.id, nodeRef) })
}

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@bcakmakoglu
Comment options

Answer selected by yczkhx-ths
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants