Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-Authored-By: hateonion <ouyang_yingjie@outlook.com>
  • Loading branch information
yuqingc and hateonion committed Mar 30, 2019
1 parent 4bf7178 commit 766a016
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions content/docs/faq-ajax.md
Expand Up @@ -8,9 +8,9 @@ category: FAQ

### 我怎样在 React 中发起 AJAX 请求{#how-can-i-make-an-ajax-call}

在React开发中,你能使用任何你喜欢的 AJAX 库,比如社区比较流行的 [Axios](https://github.com/axios/axios)[jQuery AJAX](https://api.jquery.com/jQuery.ajax/),或者是浏览器内置的 [window.fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
在 React 开发中,你能使用任何你喜欢的 AJAX 库,比如社区比较流行的 [Axios](https://github.com/axios/axios)[jQuery AJAX](https://api.jquery.com/jQuery.ajax/),或者是浏览器内置的 [window.fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)

### 我应该在 React组件的哪个生命周期函数中发起 AJAX 请求?{#where-in-the-component-lifecycle-should-i-make-an-ajax-call}
### 我应该在 React 组件的哪个生命周期函数中发起 AJAX 请求?{#where-in-the-component-lifecycle-should-i-make-an-ajax-call}

我们推荐你在 [`componentDidMount`](/docs/react-component.html#mounting) 这个生命周期函数中发起 AJAX 请求。这样做你可以拿到 AJAX 请求返回的数据并通过 `setState` 来更新组件。

Expand Down

0 comments on commit 766a016

Please sign in to comment.