Challenge: Creating a Reusable Universal List Component
Assess your ability to create a reusable universal list component in Vue.
We'll cover the following
Task
Create a universal and reusable list component by following the steps given below:
Create props for the list name and items within it, making them required, meaning that the parent component must pass that prop to the child component. Vue should issue a warning in the console if the parent component fails to pass the required prop.
Implement scoped slots for custom item rendering.
Emit a custom event
removeAllItems
inside theremoveAllItems()
method (because otherwise, Vue will complain if you try to modify the items array directly from the child component).Register the custom event in the
emits
property.
Expected output
The output of the task should look like the following:
Get hands-on with 1400+ tech skills courses.