Skip to content

How to dynamically add child components to parent. #2400

Answered by voidpumpkin
ech0r asked this question in Q&A
Discussion options

You must be logged in to vote
  • You need to keep a vec of html elements in the parents state. function components struct components
  • Create a callback that when called/emited with a new html element as an argument, adds it to the the list in the state function components struct components
  • pass that callback as a prop to the child compoennt that has that button you mentioned, the button when clicked should emit the callback from the props

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by ech0r
Comment options

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

Comment options

You must be logged in to vote
2 replies
@voidpumpkin
Comment options

@ech0r
Comment options

Comment options

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants