THIS IS NOT A DUPLICATE. I am asking about createBrowserHistory. The question you claim is a duplicate does NOT use createBrowserHistory.
I've found many questions about react-router and heroku but am having trouble finding ones using createBrowserRouter which is recommended in the v6 react-router docs.
Everything works fine locally but when I upload it to heroku, the app says 'Cannot GET' and whatever page it is for everything except my homepage. I tried adding a static.json but that didn't work. I also tried setting the homepage to my heroku apps url and that didn't help either. Here's the relevaant code snippets (the whole index.js is long)
index.js `
...const router = createBrowserRouter([
{
path: '/',
element: <Home />,
errorElement: <Error />,
children: [
]
},
{
path: 'work-history',
element: <WorkHistory />
},...
...const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<Provider store={store}>
<RouterProvider router={router} />
</Provider>
</React.StrictMode>
);`
static.js
`{
"root": "build/",
"clean_urls": false,
"routes": {
"/**": "index.html"
}
}`