Skip to content

What is the use-case for the <c-component> with the "is" attribute? #108

Answered by wrabit
ra-dave asked this question in Q&A
Discussion options

You must be logged in to vote

@ra-dave I don't have to reach for it very often, but there are times. An example:

# context
{'icons': [ 'pencil', 'pencil-square', 'pencil-circle', ... ] }
<!-- icons are saved in: 
  cotton/pencil.html
  cotton/pencil_square.html
  ... 
-->
{% for icon in icons %}
    <c-component :is="icon" />
{% endfor %}

Or they might be in subfolders:

{% for icon in icons %}
    <c-component is="subfolder.{{ icon }}" />
{% endfor %}

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by wrabit
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
Converted from issue

This discussion was converted from issue #107 on August 30, 2024 20:19.