Check this fiddle. I'd like to know how to remove the space between lines. I've already tried removing <br />, but nothing changes. Also I don't want to put negative values for margin-bottom. I don't know whether it's a react or css matter.
HTML
<div id="app"></div>
CSS
div.square {
display: inline-block;
width: 20px;
height: 20px;
}
React
class Square extends React.Component {
constructor(props) {
super(props);
this.style = {
backgroundColor: 'yellow',
borderStyle: 'solid',
borderWidth: 1
}
}
render () {
return (<div class = "square" style = {this.style}></div>);
}
}
class App extends React.Component {
constructor(props) {
super(props);
}
render() {
var ret = [];
for (var i = 0; i < this.props.m; i++) {
for (var j = 0; j < this.props.n; j++) {
ret.push(<Square></Square>);
}
ret.push(<br />);
}
return ret;
}
}
ReactDOM.render(<App m = "10" n = "10" />,document.querySelector("#app"));