OwlinLight / leetcode-planner

MIT License
0 stars 0 forks source link

Format: update store.ts format #14

Open OwlinLight opened 3 months ago

OwlinLight commented 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
}
OwlinLight commented 3 months ago

and avoid repetitive name

loadTodos = async () => {
    const db_todos = await fetchTodos();
    store.todos = db_todos!
}