I have component that I am working on but took it don to the bare minimum to exemplify my issue:
App:
class App extends React.Component{
render(){
return(
<div className="App"><div style={{width:"500px", height:"300px",margin:"0 auto",marginTop:"100px"}}><PhnGrid/></div></div>
)
}
}
export default App;
PhnGrid:
class PhnGrid extends React.Component{
dataset=[{phonetype:"",phonenumber:""}]
state = {rowcount:1}
render(){
console.log(this.state)
return(<h1>HELLO</h1>);
}
}
export default PhnGrid;
When the PhnGrid
component mounts (or when the state changes) render
is called twice everytime. Can anyone tell me what going on?