A lightweight utility for state handling outside of the component for litelements.
The goal of this little tool is to allow you to decouple your business logic from your presentation.
For this, two functions are exposed:
useState
useReducer
Use it for simple internal component state changed in a single place, something you don't want to expose to consumer of the component via props. An example can be the <todo-add> component for this demo
Use it for complex internal component state changed in multiple places, i.e. something which can be created, viewed, updated and deleted.
The useState hook is a simple mechanismn to manage your state. It makes it easy to handle single
While the useState hook can help you with small changes, as you can see in the todo app above it may lead to coupling your business logic with your presentation layer. To maintain that better, you might want to use the reducer instead.
The reducer can also be configured to dispatch `CustomEvent`s for the triggered actions. This allows you to easily bubble your changes up to the parent component, and manage your state even more easily.