0
0
Svelteframework~10 mins

svelte:fragment for grouping - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to use to group elements without extra HTML tags.

Svelte
<svelte:[1]>
  <p>First paragraph</p>
  <p>Second paragraph</p>
</svelte:[1]>
Drag options to blanks, or click blank then click option'
Afragment
Bslot
Celement
Dcomponent
Attempts:
3 left
💡 Hint
Common Mistakes
Using svelte:slot instead of svelte:fragment.
Trying to use a normal HTML tag to group elements.
2fill in blank
medium

Complete the code to pass a named slot using .

Svelte
<ChildComponent>
  <svelte:[1] slot="header">
    <h1>Title</h1>
  </svelte:[1]>
</ChildComponent>
Drag options to blanks, or click blank then click option'
Aslot
Bcomponent
Cfragment
Delement
Attempts:
3 left
💡 Hint
Common Mistakes
Using svelte:slot instead of svelte:fragment.
Not adding the slot attribute.
3fill in blank
hard

Fix the error by completing the code to group multiple elements inside a slot.

Svelte
<ParentComponent>
  <svelte:[1] slot="footer">
    <button>Cancel</button>
    <button>Save</button>
  </svelte:[1]>
</ParentComponent>
Drag options to blanks, or click blank then click option'
Aslot
Belement
Ccomponent
Dfragment
Attempts:
3 left
💡 Hint
Common Mistakes
Using svelte:slot instead of svelte:fragment.
Wrapping buttons in a div instead of using svelte:fragment.
4fill in blank
hard

Fill both blanks to correctly use with a named slot and a class attribute.

Svelte
<MyComponent>
  <svelte:[1] slot="sidebar" class=[2]>
    <nav>Menu</nav>
  </svelte:[1]>
</MyComponent>
Drag options to blanks, or click blank then click option'
Afragment
Bslot
C"sidebar-class"
D"main-class"
Attempts:
3 left
💡 Hint
Common Mistakes
Using svelte:slot instead of svelte:fragment.
Not quoting the class attribute value.
5fill in blank
hard

Fill all three blanks to create a with a named slot, a style attribute, and a data attribute.

Svelte
<Container>
  <svelte:[1] slot=[2] style=[3]>
    <p>Content here</p>
  </svelte:[1]>
</Container>
Drag options to blanks, or click blank then click option'
Afragment
B"footer"
C"color: red;"
D"header"
Attempts:
3 left
💡 Hint
Common Mistakes
Using svelte:slot instead of svelte:fragment.
Forgetting quotes around slot or style attribute values.