【问题标题】:Reactjs not updating anythingReactjs没有更新任何东西
【发布时间】:2018-04-27 09:18:00
【问题描述】:

我已经尝试禁用缓存,但它不起作用 我的代码

componentDidMount = () => {


  alert("hello")


  }

我今天没有收到警报,其他任何内容都没有更新

【问题讨论】:

标签: reactjs react-redux


【解决方案1】:

要在 React Native 中显示警报,您需要使用原生 Alert API,因为不支持浏览器定义的 alert

import { Alert } from 'react-native';

componentDidMount = () => {
    Alert.alert("hello")
}

【讨论】:

  • 但它以前工作过,

    标签也没有更新,没有别的

  • 只有这段代码恐怕无法提供更多答案。
【解决方案2】:

我试过了

 componentWillMount() {
       
       alert("hello")
   }

这成功了

【讨论】:

  • 请提供有关您的对象的更多详细信息。让我们看看并解决这个问题
猜你喜欢
  • 2021-02-24
  • 1970-01-01
  • 2019-06-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-01-16
  • 2021-10-29
  • 2015-02-11
相关资源
最近更新 更多