How can you write duplicate virtual nodes in a component?

Posted by Jennifer | Updated on

How can you write duplicate virtual nodes in a component?

All virtual nodes(VNodes) in the component tree must be unique.i.e, You can’t write duplicated nodes in a straightforward way. If you want to duplicate the same element/component many times then you should use factory function.

The below render function is invalid where you are trying to duplicate h1 element 3 times:

You can make duplicates with factory function:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers