I always use props directly without set it to state and it works just fine, but should I really set state from props and then use that state instead. what's the difference?
Class A extends Component {
...some method,
render() {
return <>{this.props.message}</>
}
}
Class A extends Component {
constructor() {
super();
this.state = {
message: ''
}
}
componentDidMount(){
this.setState({message: this.props.message})
}
render() {
return <>{this.state.message}</>
}
}