I created a web app in React and now i'm trying to deploy it on a host.
I ran npm run build
from the command line.
I copied files from the 'build' folder that is created and uploaded them in my host's folder (public_html/app).
but I only see a white screen in my mydomain.com/app or mydomain.com/app/index.html
Ok, now is working... after create a .htaccess file and also add the 'homepage' value in the package.json file.
But I can't see my jsx components. I only see the app.js contents
My index.js looks like this:
import { createRoot } from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
const container = document.getElementById('root');
const root = createRoot(container);
root.render(<App tab="home" />);
reportWebVitals();
app.js
return (
<div className="app-container">
<header className="app-header">
<img src={logo} className="logo-header" alt='logo' />
<Router>
<Routes>
<Route index element={<Register />} />
<Route path="/Login" caseSensitive={false} element={<Login />} />
<Route path="/Register" caseSensitive={false} element={<Register />} />
<Route path='/Profile' caseSensitive={false} element={<Profile />} />
<Route path='/Formrdo' caseSensitive={false} element={<Formrdo />} />
<Route path='/Setup' caseSensitive={false} element={<Setup />} />
<Route path='/ResetPassword' caseSensitive={false} element={<ResetPassword />} />
</Routes>
</Router>
</header>
package.json
.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
</IfModule>```