utquidem
Version:
The meta-framework suite designed from scratch for frontend-focused modern web development.
31 lines (22 loc) • 433 B
Markdown
sidebar_position: 2
# state
:::info 补充信息
**state** 表示 **Model** 的状态。
:::
Modern.js 支持定义各种类型的 **state**。
## 示例
```ts
import { model, useModel } from '@modern-js/runtime/model';
const fooModel = model('foo').define(() => {
return {
state: 'foo'
}
});
function App() {
const [state, actions] = useModel(fooModel);
// "foo"
return <div>state: {state}</div>
}
```