Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 1.55 KB

kata-02.md

File metadata and controls

27 lines (18 loc) · 1.55 KB

Qwik Kata 2 - State management

The purpose of this kata is to get you acquainted with state management in Qwik. The kata assumes you have already completed kata 1.

Learning aims

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

Task

Complete the following:

  1. Add local state called items (an array of strings) to the Inventory component. The state can be empty initially.
  2. 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 using onInput$ though going through a reference is neater in this case.
  3. Optional - After adding a new item, reset the related input that contained the value to add
  4. Allow the user to remove items from an Inventory within the component
  5. Optional - Allow the user to modify items within an Inventory within the component
  6. 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.
  7. Run the application in a production mode and observe the network tab of the browser inspector

Navigation