Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
TypeError:无法读取属性';字符串';将google标记管理器添加到reactjs站点时未定义的_Reactjs_Google Tag Manager_React Proptypes_React Static - Fatal编程技术网

TypeError:无法读取属性';字符串';将google标记管理器添加到reactjs站点时未定义的

TypeError:无法读取属性';字符串';将google标记管理器添加到reactjs站点时未定义的,reactjs,google-tag-manager,react-proptypes,react-static,Reactjs,Google Tag Manager,React Proptypes,React Static,我的网站建立在react static,一个基于reactjs的框架之上 我跟随谷歌向项目中添加react谷歌标签管理器 当我刷新页面时,浏览器上出现以下错误,适用于GoogleTagManager模块: TypeError:无法读取未定义的属性“字符串” 在 它的作用不再是Proptypes属性 环境: “反应”:“16.8.4” “react谷歌标签管理器”:“2.2.1” 。它在v15.5中被移动到一个单独的包中 import PropTypes from 'prop-types';

我的网站建立在
react static
,一个基于
reactjs
的框架之上

我跟随谷歌向项目中添加
react谷歌标签管理器

当我刷新页面时,浏览器上出现以下错误,适用于GoogleTagManager模块:

TypeError:无法读取未定义的属性“字符串”

它的作用不再是
Proptypes
属性

环境:

  • “反应”:“16.8.4”
  • “react谷歌标签管理器”:“2.2.1”
。它在v15.5中被移动到一个单独的包中

import PropTypes from 'prop-types';

class GoogleTagManager extends React.Component {
  static propTypes = {
    gtmId: PropTypes.string.isRequired,
    // ...
  };

  // ...
}
import PropTypes from 'prop-types';

class GoogleTagManager extends React.Component {
  static propTypes = {
    gtmId: PropTypes.string.isRequired,
    // ...
  };

  // ...
}