React
by evgkch
HTML
<div id="app"></div>
CSS
html {
overflow-x: none;
}
body {
background: #20262E;
padding: 20px;
font-family: Helvetica;
overflow-x: none;
}
#app {
background: #fff;
border-radius: 4px;
padding: 20px;
transition: all 0.2s;
overflow-x: none;
}
.wrapper {
min-width: 300px;
overflow-x: auto;
}
table {
width: 100%;
}
td {
border: solid 1px black;
}
React
class TodoApp extends React.Component {
constructor(props) {
super(props)
this.state = {
head: ['id', 'content'],
items: Array.from({ length: 10 }, (v, k) => {
return { id: k, content: k };
})
};
}
render() {
return (
<div className="wrapper">
<table>
{this.state.items.map((item, i) => {
return (
<tr key={i}>
<td>{item.id}</td>
<td>{item.content}</td>
</tr>
);
})}
</table>
</div>
)
}
}
ReactDOM.render(<TodoApp />, document.querySelector("#app"))