美文网首页
react 初次尝试遇到的问题

react 初次尝试遇到的问题

作者: Aug08 | 来源:发表于2020-06-29 15:48 被阅读0次

错误1如下图所示


image.png

错误原因:
子组件已经export default

  • 不能使用import {FancyBorder} from "./FancyBorder.js" 引用
  • 应该使用import FancyBorder from "./FancyBorder.js" 引用

错误二:
react-dom.development.js?61bb:88 Warning: This synthetic event is reused for performance reasons. If you're seeing this, you're accessing the property target on a released/nullified synthetic event. This is set to null. If you must keep the original synthetic event around, use event.persist(). See https://fb.me/react-event-pooling for more information.
错误原因
e.target.value 不可以直接放到setstate里取值
解决办法:
先使用变量存值
再设置值
let value = e.target.value
this.setState({
value:value
})

相关文章

网友评论

      本文标题:react 初次尝试遇到的问题

      本文链接:https://www.haomeiwen.com/subject/zboofktx.html