Complete the code to declare a readonly prop in a Svelte component.
<script>
export let name[1];
</script>In Svelte, you mark a prop as readonly by adding the readonly keyword after let.
Complete the code to prevent modification of a prop inside the component.
<script>
export let count[1];
// Trying to change count here will cause an error
</script>Using readonly after let makes the prop immutable inside the component.
Fix the error in the code by making the prop readonly.
<script> export let message[1]; message = 'New message'; // This should cause an error </script>
Adding readonly after let prevents reassignment of the prop inside the component.
Fill both blanks to declare a readonly prop and use it in markup.
<script> export let title[1]; </script> <h1>[2]</h1>
The prop is declared readonly with readonly. The markup uses the prop title to display it.
Fill all three blanks to declare multiple readonly props and use them in markup.
<script> export let firstName[1]; export let lastName[2]; </script> <p>Hello, [3] {{lastName}}!</p>
Both props are declared readonly with readonly. The markup uses firstName and lastName to greet the user.