Hi guys im making web app where im bulding table, here is the code for it:
class Table1 extends Component {
render() {
return (
<div>
<BootstrapTable data={this.props.data}>
<TableHeaderColumn isKey dataField='id'>
</TableHeaderColumn>
<TableHeaderColumn dataField='name'>
</TableHeaderColumn>
<TableHeaderColumn dataField='value'>
</TableHeaderColumn>
</BootstrapTable>
</div>
);
}
}
export default Table1;
then in my index.js
file i use this to get data from firebase and put it to table
db.onceGetUsers().on("child_added", snap =>{
var username = snap.child("name").child("name").val();
this.setState({users: username})
and here is how i pass data to table:
render() {
var data = [
{name: this.state.users}
];
return (
<body className = "aa">
<div >
<div className = "bb">
<Table1 data={data}/>
</div>
</div>
</body>
and it displays data.. but only in one row. When I'm debbuging it, theres only one row where appears 1st username then it dissapears and 2nd username appears, and it goes like that, then at the end it displays last username, and this all happens in only one cell in column "name", how can i solve that ?