我正在将 reactjs 与我的 django 集成,我已经完成了设置,甚至还可以从服务器渲染页面,但是在客户端渲染和事件处理和附加时,我收到错误“未捕获的 ReferenceError:MainContainer 未定义” . 我完全迷失在这里,请帮助我。
<html>
<head>
<link rel="stylesheet" type="text/css" href="static/src/css/bootstrap.min.css"/>
<link rel="stylesheet" type="text/css" href="static/src/css/style.less"/>
</head>
<body>
<script>
// var INITIAL_DATA = JSON.parse('{{ serialized_value|safe }}')
var INITIAL_DATA = {{ serialized_value|safe }}
</script>
<div id="app">{{ rendered|safe }}</div>
<script type="text/javascript" src="static/build/index_webpack.js"></script>
<script>
// ReactDOM.render(React.createFactory(MainContainer)({isOpen: false, props: {'freeShipping': free_shipping_message_new,'navigationBar': [loose_leaf_content]}}), document.getElementById('app'));
ReactDOM.render(MainContainer({isOpen: false, props: {'freeShipping': free_shipping_message_new,'navigationBar': [loose_leaf_content]}}), document.getElementById('app'));
</script>
</body>
</html>