@Sexy Somapala Machan, rendering two times is actually not a bug. It's a feature. So you need to design your code in a way that it is not a problem for the component to unmounted and then mounted again. I took your code and change a bit it as follows. Though the render happens two times the list only shows up when the response gets back with data.
It is good you asked this question. I was also not 100% sure what's going on so had to dig in.
import React, { Component } from 'react';
class App extends Component{
constructor(){
super()
this.state = {
monsters: []
}
}
componentDidMount() {
console.log("inside componentDidMount");
fetch('
https://jsonplaceholder.typicode.com/users')
.then((response) => response.json())
.then((users) => {
this.setState({monsters: users})
console.log(this.state.monsters)
})
}
render(){
return(
<>
{ this.state.monsters.map((monster) => {
<h1 key={monster.id}>{ monster.name }</h1>
})}
</>
)
}
}
export default App;