我正在处理Grommet的starter example,当我添加<AppBar>
标记时遇到了这个错误:
defaultValidatorFn is not a function
TypeError: defaultValidatorFn is not a function
at shouldForwardProp (http://localhost:3000/main.c6cdacb143c3e873b1fb.hot-update.js:4491:12)
at http://localhost:3000/main.c6cdacb143c3e873b1fb.hot-update.js:11014:142
at D (http://localhost:3000/main.c6cdacb143c3e873b1fb.hot-update.js:11023:6)
at renderWithHooks (http://localhost:3000/static/js/bundle.js:31049:22)
at updateForwardRef (http://localhost:3000/static/js/bundle.js:33620:24)
at beginWork (http://localhost:3000/static/js/bundle.js:35667:20)
at HTMLUnknownElement.callCallback (http://localhost:3000/static/js/bundle.js:20641:18)
at Object.invokeGuardedCallbackDev (http://localhost:3000/static/js/bundle.js:20685:20)
at invokeGuardedCallback (http://localhost:3000/static/js/bundle.js:20742:35)
at beginWork$1 (http://localhost:3000/static/js/bundle.js:40616:11)
字符串
在进一步检查时,控制台显示一系列警告,如下所示:
styled-components: it looks like an unknown prop "full" is being sent through to the DOM, which will likely trigger a React console error
型
我试了yarn add @emotion/is-prop-valid
,但没有任何区别。我在这里做错了什么?
2条答案
按热度按时间nvbavucw1#
其中一个步骤是将
styled-components
添加到依赖项中。最新的主要版本是6,但Grommet目前只兼容5。我将版本改为package.json
中的^5.3.11
,解决了这个问题。n7taea2i2#
yarn add email protected(https://stackoverflow.com/cdn-cgi/l/email-protection)对我来说很好用。我使用“”:“^2.34.2”
参考:来自网站https://github.com/grommet/grommet#install
注意:目前,Grommet只与样式化组件v5兼容。我们正在积极努力添加对v6的支持