umijs / umi

A framework in react community ✨
https://umijs.org
MIT License
15.3k stars 2.65k forks source link

UMI3,国际化使用后useIntl直接报错 #5178

Closed gaomeng965 closed 4 years ago

gaomeng965 commented 4 years ago

What happens?

UMI3,国际化使用后useIntl直接报错; Error: Invalid hook call. Hooks can only be called inside of the body of a function component. UMI2的时候使用formatMessage正常; 升级了react的版本也不行; "react": "16.13.0", "react-dom": "16.13.0",

Mini Showcase Repository(REQUIRED)

Provide a mini GitHub repository which can reproduce the issue. Use yarn create @umijs/umi-app then upload to your GitHub

How To Reproduce

Steps to reproduce the behavior: 1. 2.

Expected behavior 1. 2.

Context

gaomeng965 commented 4 years ago

好吧,这个api只能用在function中不能用在class中