Svelte.js Questions et reponses d'entretien
Question 6. How can you perform conditional rendering in Svelte?
Conditional rendering in Svelte can be done using the 'if' and 'else' blocks. For example: {#if condition} ... {:else} ... {/if}
Question 7. Explain the concept of stores in Svelte.
Stores in Svelte are reactive containers for state management. They allow sharing state between components and automatically update when the state changes.
Question 8. What is the purpose of the 'bind:' directive in Svelte?
The 'bind:' directive in Svelte is used for two-way binding. It establishes a connection between a parent component's property and a child component's property, ensuring changes in one affect the other.
Question 9. How does Svelte handle animations?
Svelte has built-in support for animations. You can use the 'animate:' directive to create smooth transitions and animations between state changes in components.
Question 10. What is the purpose of the 'on:' directive in Svelte?
The 'on:' directive in Svelte is used to handle DOM events. For example: {on: {click: handleClick}}
Les plus utiles selon les utilisateurs :
- What is Svelte.js?
- Explain the concept of reactivity in Svelte.
- How can you perform conditional rendering in Svelte?
- What is the purpose of the 'on:' directive in Svelte?
- How does Svelte handle global CSS styles?