In react components is it preferred to set the initial state in the constructor() or componentWillMount()?
export default class MyComponent extends React.Component{
constructor(props){
super(props);
this.setState({key: value});
}
}
or
export default class MyComponent extends React.Component{
componentWillMount(props){
this.setState({key: value});
}
}