出现错误:TypeError:标记[primaryAttributeKey] .toLowerCase不是React Helmet中的函数

问题描述

我将动态变量放在Helmet中,当时我遇到此错误TypeError: tag[primaryAttributeKey].toLowerCase is not a function,它在静态环境中可以正常工作,在这里我已经上传了我的代码,任何人都可以检查我的代码并获得帮助我要解决这个问题吗?

constant.json

{
    "GAME" : "talking"
}

constant_gmae.json

{
    "talking": {
        "GOOGLE_ANALYTICS_URL": "https://www.googletagmanager.com/******","GOOGLE_ANALYTICS_CODE": "UA-*******"
    }
}

App.js

import ConstantGame from '../../../constant.json';
import Constant from '../../../constant_game.json';

export const NavButtons = () => {

    return (
        <>
            <Helmet>
            <script>
                    window.dataLayer = window.dataLayer || [];
                    gtag('js',new Date()); 
                    gtag('config','{Constant[ConstantGame.GAME].GOOGLE_ANALYTICS_CODE}' );
                </script>
            </Helmet>
        <>
    )
} 

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)