获取TypeError:t(...)。在浏览器上执行reactjs代码时,对象未定义

时间:2017-08-30 11:00:00

标签: javascript reactjs

我已经编写了一个基本代码来开始学习Reactjs。但是在加载网页后,我在浏览器控制台中遇到了以下错误。此外,网页为空白,未显示任何输出。

TypeError:t(...)。对象未定义[了解详情] browser.min.js:8:31612

以下是代码:

 CrossConnectivity.Current.ConnectivityChanged += (object sender, Plugin.Connectivity.Abstractions.ConnectivityChangedEventArgs e) =>
    {
          if(e.IsConnected){
            //your code here for fetching data when internet connected.
            //Create task for background process 
            Task.Run(() =>
            {
                //your code for background

            }).ConfigureAwait(false);
          }
    }

有人可以告诉我代码中是否有错误。我从正确运行的在线教程中复制了这段代码。

2 个答案:

答案 0 :(得分:0)

你应该将babel-core改为babel-standalone。

看看:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width-device-width, initial-scale-1" >
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.6.1/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.6.1/react-dom.js"></script>
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>
<body>
	<div id="root"></div>
	<script type="text/babel">
		ReactDOM.render(<div>Sameer</div> , document.getElementById("root"));
	</script>
</body>
</html>

现在它的工作正确!

您可以在浏览器here

中详细了解如何使用babel

答案 1 :(得分:-1)

&#13;
&#13;
<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width-device-width, initial-scale-1" >
        <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react-dom.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.25.0/babel.min.js"></script>
    </head>
    <body>
        <div id="root"></div>
        <script type="text/babel">
          ReactDOM.render(<div>Sameer</div> , document.getElementById("root"));
        </script>
    </body>
</html>
&#13;
&#13;
&#13;