Open OwlinLight opened 3 months ago
Note This way is preferred as it is better for code splitting. (https://valtio.pmnd.rs/docs/how-tos/how-to-organize-actions)
import { proxy } from 'valtio' export const state = proxy({ count: 0, name: 'foo', }) export const inc = () => { ++state.count } export const setName = (name) => { state.name = name }
and avoid repetitive name
loadTodos = async () => { const db_todos = await fetchTodos(); store.todos = db_todos! }
Note This way is preferred as it is better for code splitting. (https://valtio.pmnd.rs/docs/how-tos/how-to-organize-actions)