8000 为什么 React 文档建议在 componentDidMount 中发起 ajax 请求? · Issue #2 · forl/articles · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
为什么 React 文档建议在 componentDidMount 中发起 ajax 请求? #2
Open
@forl

Description

@forl

React 的官方文档中建议在 componentDidMount 中执行有副作用的操作,比如发起 ajax 请求,相信很多人读到过这一建议,并且在日常工作中也是这样遵循的。但是问什么会有这样的建议呢?React 项目中有这样一个 issue,讨论的就是这一建议背后的原因:

reactjs/react.dev#302

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0