React Ref Componentdidmount
# React componentDidMount() Method
[ React Component Lifecycle](#)
The componentDidMount() method format is as follows:
componentDidMount()
The componentDidMount() method is called immediately after a component is mounted (inserted into the DOM tree).
Initialization that depends on DOM nodes should be placed in the componentDidMount() method.
The following example will first output ****, then use the componentDidMount() method to set it to output **google** after the component is mounted:
## Example
```class Header extends React.Component{
constructor(props){
super(props);
this.state = {favoritesite: ""};
}
componentDidMount(){
setTimeout(() =>{
this.setState({favoritesite: "google"})
}, 1000)
}
render(){
return(
YouTip