Skip to content

Commit 49becb3

Browse files
committed
redirect to home on invalid route
1 parent 492dd5c commit 49becb3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/App.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
22
import Navbar from './components/Navbar';
33
import './App.css';
44
import Home from './components/Home/Home';
5-
import { Switch, Route } from 'react-router-dom';
5+
import { Switch, Route, Redirect } from 'react-router-dom';
66
import Footer from './components/Footer';
77
import Resource from './components/Category/Resource';
88
import Resources from './components/Category/Resources';
@@ -36,6 +36,7 @@ function App() {
3636
path='/resources/:id'
3737
render={(props) => <Resource {...props} />}
3838
/>
39+
<Redirect to='/' />
3940
</Switch>
4041
<Footer />
4142
</div>

0 commit comments

Comments
 (0)