我正在使用ReactJS来创作网页。我很难将多个React组件集成到同一个网页中。代码似乎编译成功,但在尝试提供网页时我得到一个空白网页。
代码如下:
import ReactDOM from 'react-dom';
import React, { Component } from 'react';
class form1 extends Component{
render(){
return(
<div class="form">
<form action="/result" method="post">
<input type="text" name="place" />
<input type="submit" />
</form>
</div>
);
}
}
class tester extends Component{
render(){
return(
<div class="form">
<form action="/result_tester" method="post">
<input type="text" name="place_tester" />
<input type="submit" />
</form>
</div>
);
}
}
class aggregator extends Component{
render(){
return(
<div>
<form1/>
<tester/>
</div>);
}
}
ReactDOM.render(
<aggregator/>,
document.getElementById('root')
);