Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
skimklin committed Jul 25, 2023
1 parent a8a8ac9 commit 6d4891e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default defineConfig({
* global: boolean | string[]
* 1. 若值为true,会把uModels下所有合法文件的默认导出全部注册到全局(不推荐)
* 2. 若值为sting[],会把列表中存在的注册到全局,剩下的用户自行处理(性能较好)
* 3. uModels所有合法文件都会注册为Container并添加到umi下,导出key为unstatedModels(import { unstatedModels } from 'umi')
* 3. uModels所有合法文件都会注册为Container并添加到umi下,导出key为uModels(import { uModels } from 'umi')
*/
global: ['global'],
/**
Expand Down Expand Up @@ -65,10 +65,10 @@ export default function useGlobal() {

```javascript
import React from 'react';
import { unstatedModels } from 'umi';
import { uModels } from 'umi';

const App = () => {
const { global } = unstatedModels.global.useContainer();
const { global } = uModels.global.useContainer();
return <div>{global}</div>;
};
```
Expand All @@ -89,18 +89,18 @@ export default function useExample() {

// MyComponent.tsx
import React from 'react';
import { unstatedModels } from 'umi';
import { uModels } from 'umi';

const ChildComponent = () => {
const { exampleState } = unstatedModels.example.useContainer();
const { exampleState } = uModels.example.useContainer();
return (
<div>
child: {exampleState}
</div>
)
}
const MyComponent = () => {
const { exampleState } = unstatedModels.example.useContainer();
const { exampleState } = uModels.example.useContainer();
return (
<div>
{exampleState}
Expand All @@ -109,5 +109,5 @@ const MyComponent = () => {
)
}

export default () => unstatedModels.example.wrapProvider(<MyComponent/>)
export default () => uModels.example.wrapProvider(<MyComponent/>)
```

0 comments on commit 6d4891e

Please sign in to comment.