We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The text was updated successfully, but these errors were encountered:
继续简化结构,不再使用id标识,类似这样:
const app = { todos: [], @computed get count() { return this.todos.length; }, add(todo: string) { this.todos.push(todo); } }
使用时:
function App() { - // 按需导入(废弃原因1、需要固定的解构模式;2、复杂数据结构支持不太好) - const { todos, count, add } = useStore(app); + // 按需导入,使用selector,可支持复杂数据,可利于依赖分析,可使用柯里化简化调用 + const count = useStore(app, app => app.count); return <div onClick={()=>app.add('something')}>{count}</div> }
在非react组件中:
const count = app.count; app.add('123')
Sorry, something went wrong.
已完成,改动较大,重新写了另外一个库:https://github.com/sky0014/store ,适用于大型的需要多store的项目。
本项目本质上是对redux和immer的重新组合,技术上较为成熟,仍可继续使用。
No branches or pull requests
The text was updated successfully, but these errors were encountered: