I would like to redirect my url for e.g to '/questions/1' when I only write /questions
            Asked
            
        
        
            Active
            
        
            Viewed 3,667 times
        
    1 Answers
8
            You can render a redirect from one path to the other.
If using react-router-dom v5 use the Redirect component:
<Redirect from="/questions" to="/questions/1" />
If using react-router-dom v6 use the Navigate component:
<Route path="/questions" element={<Navigate to="/questions/1" replace />} />
 
    
    
        Drew Reese
        
- 165,259
- 14
- 153
- 181
