Testing React components that fetches data using Hooks

后端 未结 5 1427
不知归路
不知归路 2020-12-02 00:02

My React-application has a component that fetches data to display from a remote server. In the pre-hooks era, componentDidMount() was the place to go. But now I

5条回答
  •  臣服心动
    2020-12-02 00:07

    Enzyme doesn't have support for hooks since it's a relatively new feature: https://github.com/airbnb/enzyme/issues/2011

    Maybe you can use plain Jest in the meantime? Also don't worry about the warning, it's supposed to go away when React 16.9.0 is released (see this pull request https://github.com/facebook/react/pull/14853)

提交回复
热议问题