This is my first post here :) so be cool with me please :)
I try to do a custom 404 with create-react-app V.17.0.2 and react-router-dom V.5.2.0.
It works when i try on local server but something is wrong when i deploy on github-pages.
I have only one path='/', and i want all the others redirect to my error404 component.
I made one in an other project lastProject published on Netlify and to fix this i have just create a _redirects file in the public folder and write /*  /index.html  200 inside , it works perfectly.
Here works Netlify
i want to find a same easy solution to published on github-pages. I don't want to change the BrowserRouter by Hashrouter and have a '#' in my URL, and this solution is very difficult to me
EDIT: So now i use hashrouter and wait to see an other easy solution
import React from 'react';
import { Route, Switch } from 'react-router-dom';
import Header from '../Header';
import Main from '../Main';
import Footer from '../Footer';
import Error404 from '../Error404'
function App() {  
  return (
    <div className="App" >
      <Switch>
        <Route exact path='/'>          
          <Header />
          <Main/>         
          <Footer/>
        </Route>
        <Route component={Error404}/>      
      </Switch>
    </div>
  );
}
export default App;
 
    