Setting state on componentDidMount() : <p>I know that it is an anti-pattern to set state on <code>componentDidMount</code> and a state should be set on <code>componentWillMount</code> but suppose I want to set the length of the number of <code>li</code> tags as a state. In that case, I can't set the state on <code>componentWillMount</code> since the <code>li</code> tags might not have been mounted during that phase. So, what should be the best option here? Will it be fine if I set the state on <code>componentDidMount</code>?</p>
