ExamGecko
Question list
Search
Search

List of questions

Search

Question 195 - Certified B2B Commerce Administrator discussion

Report
Export

A developer needs to loop through a series of child components which are tiles. What is the correct syntax for this if the child component is called appTile?

A)

B)

C)

A.
Option A
Answers
A.
Option A
B.
Option B
Answers
B.
Option B
C.
Option C
Answers
C.
Option C
Suggested answer: B

Explanation:

To loop through a series of child components which are tiles, the developer needs to use the template for:each directive, which iterates over an array and renders a nested template for each item. The developer also needs to use the for:item attribute to specify a variable name for the current item in the iteration, and the key attribute to assign a unique identifier for each item. The syntax for using the template for:each directive is:

<template for:each={items} for:item=''item'' key={item.id}> <!-- nested template --> </template>

In this case, the developer wants to loop through a series of appTile components, which are child components that display some information about an app. The developer needs to pass the app data as an attribute to the appTile component, and use the dot notation to access the app properties. The correct syntax for this is:

<template for:each={apps} for:item=''app'' key={app.id}> <c-app-tile app={app} name={app.name} rating={app.rating}></c-app-tile> </template>

Therefore, the correct answer is Option B, which matches this syntax. Option A is incorrect because it uses the wrong attribute name for:item instead of for:item. Option C is incorrect because it uses the wrong attribute name key instead of key, and it does not pass the app data as an attribute to the appTile component.

asked 23/09/2024
RAOUL AMODIO
46 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first