React & ASP.NET MVC 5 服务器端渲染 console.log('text') 不显示
React & ASP.NET MVC 5 server side rendering console.log('text') does not show up
我有一些代码
index.cshtml
<div>
@Html.React("App", new {i = 10})
</div>
App.jsx
class App extends React.Component{
constructor(props){
super(props);
console.log(this.props.i);
}
render(){
return (
<div>this.props.i</div>
)
}
}
由于某种原因,构造函数中的 console.log 没有在我的终端中打印出来,但它在 html 中正确显示了值 10。在 asp.net 中修复此问题或调试 React 有什么建议吗?提前致谢。
class App extends React.Component{
constructor(props){
super(props);
console.log(this.props.i);
}
render(){
return (
<div> { this.props.i } </div>
)
}
}
You should see the console on Server console
NOTE the typo on your render method. (missing {})
我有一些代码
index.cshtml
<div>
@Html.React("App", new {i = 10})
</div>
App.jsx
class App extends React.Component{
constructor(props){
super(props);
console.log(this.props.i);
}
render(){
return (
<div>this.props.i</div>
)
}
}
由于某种原因,构造函数中的 console.log 没有在我的终端中打印出来,但它在 html 中正确显示了值 10。在 asp.net 中修复此问题或调试 React 有什么建议吗?提前致谢。
class App extends React.Component{
constructor(props){
super(props);
console.log(this.props.i);
}
render(){
return (
<div> { this.props.i } </div>
)
}
}
You should see the console on Server console
NOTE the typo on your render method. (missing {})