Skip to content

Commit

Permalink
fix: remove react unstable concurrent (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
monkindey authored and janryWang committed Aug 19, 2019
1 parent fb1ebbb commit 0f7edab
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
20 changes: 10 additions & 10 deletions docs/Examples/antd/Actions.md
Expand Up @@ -33,7 +33,8 @@ import 'antd/dist/antd.css'

const actions = createFormActions()

actions.setFieldState('aa', state => { //同步调用会出错
actions.setFieldState('aa', state => {
//同步调用会出错
state.value = '123'
})
actions.submit() //同步调用会出错
Expand All @@ -48,24 +49,23 @@ const App = () => (
>
<Field name="aa" type="string" required title="AA" />
<FormButtonGroup offset={6}>
<Button onClick={()=>{
<Button
onClick={() => {
//异步调用没问题
actions.setFieldState('aa', state => {
state.value = 'hello world'
})
actions.submit()
}}>修改AA的值并提交表单</Button>
}}
>
修改AA的值并提交表单
</Button>
</FormButtonGroup>
</SchemaForm>
</Printer>
)
console.log(React.unstable_ConcurrentMode)
ReactDOM.render(
<React.unstable_ConcurrentMode>
<App />
</React.unstable_ConcurrentMode>,
document.getElementById('root')
)

ReactDOM.render(<App />, document.getElementById('root'))
```

### 使用 createAsyncFormActions 做通讯
Expand Down
20 changes: 10 additions & 10 deletions docs/Examples/next/Actions.md
Expand Up @@ -33,7 +33,8 @@ import '@alifd/next/dist/next.css'

const actions = createFormActions()

actions.setFieldState('aa', state => { //同步调用会出错
actions.setFieldState('aa', state => {
//同步调用会出错
state.value = '123'
})
actions.submit() //同步调用会出错
Expand All @@ -48,24 +49,23 @@ const App = () => (
>
<Field name="aa" type="string" required title="AA" />
<FormButtonGroup offset={6}>
<Button onClick={()=>{
<Button
onClick={() => {
//异步调用没问题
actions.setFieldState('aa', state => {
state.value = 'hello world'
})
actions.submit()
}}>修改AA的值并提交表单</Button>
}}
>
修改AA的值并提交表单
</Button>
</FormButtonGroup>
</SchemaForm>
</Printer>
)
console.log(React.unstable_ConcurrentMode)
ReactDOM.render(
<React.unstable_ConcurrentMode>
<App />
</React.unstable_ConcurrentMode>,
document.getElementById('root')
)

ReactDOM.render(<App />, document.getElementById('root'))
```

### 使用 createAsyncFormActions 做通讯
Expand Down

0 comments on commit 0f7edab

Please sign in to comment.