The purpose of this kata is to get you acquainted with state management in Qwik. The kata assumes you have already completed kata 1.
The idea here is to build up a data model of the application and cover the following:
- Manipulating local state in Qwik
- Understanding the Qwik difference when it comes to application behavior
Complete the following:
- Add local state called
items
(an array of strings) to theInventory
component. The state can be empty initially. - Allow the user to add new items to the
Inventory
within the component. Hint: You can use a signal for storing a reference to the input. Another way would be to track the item to be added usingonInput$
though going through a reference is neater in this case. - Optional - After adding a new item, reset the related input that contained the value to add
- Allow the user to remove items from an
Inventory
within the component - Optional - Allow the user to modify items within an
Inventory
within the component - Optional - Try implementing slots for the
Inventory
component to allow the consumer to inject the component styling. This type of API design can lead to headless components that are flexible to use. - Run the application in a production mode and observe the network tab of the browser inspector