title: Navigate using react-router-dom v6 after performing user action
body: <p>I started learning react about 15 days back. The following code adds the post correctly but does not redirect to &quot;/&quot;. I am using react-router-dom v6.</p>
  <pre><code>render(){
    return &lt;div&gt;
                &lt;Routes&gt;
                  &lt;Route exact path=&quot;/&quot; element={
                        &lt;div&gt;
                        &lt;Title title={'Arijit - Photowall'}/&gt;   
                          &lt;Photowall posts={this.state.posts} onRemovePhoto={this.removePhoto} /&gt; 
  
                        &lt;/div&gt;
  
        } &gt;
                            &lt;/Route&gt;
                      &lt;Route path=&quot;/addPhotos&quot; element={ 
                       
                      &lt;AddPhoto onAddPhoto={(addedPost)=&gt;{
            
                        this.addPhoto(addedPost)
                        
                        
                        }}
                        
                        &gt;
                          &lt;Navigate to=&quot;/&quot; /&gt;
                        &lt;/AddPhoto&gt;
                        
                       }/&gt;
                    &lt;/Routes&gt;
          &lt;/div&gt;
  }
  </code></pre>