...

/

Various Patterns for Creating State and Actions

Various Patterns for Creating State and Actions

Learn some patterns to create state and actions in Valtio.

Valtio itself provides basic functions proxy and useSnapshot. It’s up to developers to decide how to organize a state object and actions.

Let’s look at some patterns to create a simple store.js.

As an example, we use a tiny app with one Counter and one TextBox.

State object and action functions

This is what we saw in the previous lesson.


const state = proxy({
  count: 0,
  text:
...
Access this course and 1400+ top-rated courses and projects.