Meteor/React, redirect route after changeState
<p>I have a problem redirecting my routes with react router after a state change.</p>

<p>In fact, my route is working when I'm using a click event who change the state (currentListId), but it's not working when I delete an element by Id (listId), so after a setState( listSelected: "") ...
My routes still display the /idlistselected instead redirect to /.</p>

<p>Here is some code:</p>

<p><strong>Page code:</strong></p>

<pre><code>constructor(props) {
    super(props);
    this.state = { listSelected: "" };
    this.selectList = this.selectList.bind(this);
}

selectList(listId) {
    this.setState({ listSelected: listId });

    // Here, only the if listId Works
    if (listId)
        browserHistory.push('/admin/todos/' + listId);
    else
        browserHistory.push('/admin/todos/');
}

render() {
    return (
            &lt;ListPanel
                listSelected = {this.state.listSelected} 
                selectList = {this.selectList} 
                lists = {this.props.lists} 
                tasks = {this.props.tasks}
            /&gt;
</code></pre>

<p><strong>Then The ListPanel:</strong></p>

<pre><code>renderLists() {
    return this.props.lists.map((list) =&gt; (
        &lt;List 
            selectedItemId ={this.props.listSelected}
            selectList = {() =&gt; this.props.selectList(list._id)}
            key = {list._id}
            list = {list}
            countPendingTasks = {this.countPendingTasks(list._id)}
        /&gt;
    ));
}
</code></pre>

<p><strong>And finally the list:</strong></p>

<pre><code>deleteThisList() {
    Meteor.call('lists.remove', this.props.list._id, (err) =&gt; {
        if (!err) {
            this.props.selectList(null);
        }   
    });
}

render() {
    return (
        &lt;ListGroupItem 
            className={(this.props.list._id == this.props.selectedItemId) ? 'active' : ''} 
            onClick={this.props.selectList}
        &gt;
            {this.props.list.name}

            &lt;Glyphicon className="pushRight red"onClick={() =&gt; this.deleteThisList()}/&gt;
        &lt;/ListGroupItem&gt;
    );
}
</code></pre>

<p>If I display the listId in the selectList, I have the past ID when I remove a list .. I can't find why cause I set it to null in the delete function ...</p>

<p>Thanks for the help.</p>