Open gokhanozdemir opened 14 hours ago
App.jsx
import React from "react";
import Homepage from "./components/Homepage";
import ProductPage from "./ProductPage/ProductPage";
import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
import Products from "./components/Products";
import Contact from "./components/Contact";
import Team from "./components/Team";
import About from "./components/About";
import Loginpage from "./LoginPage/LoginPage";
import SignUpPage2 from "./LoginPage/SignUpPage2";
//import Order from "./components/AddAddress";
import Order from "./components/Order";
import { useDispatch } from "react-redux";
import { useEffect } from "react";
import { verifyToken } from "./store/action/userAction";
function App() {
const dispatch = useDispatch();
useEffect(() => {
dispatch(verifyToken());
}, [dispatch]);
return (
<Router>
<Switch>
<Route path="/" exact component={Homepage} />
<Route path="/products" component={ProductPage} />
<Route path="/product" component={Products} />
<Route path="/contact" component={Contact} />
<Route path="/team" component={Team} />
<Route path="/about" component={About} />
<Route path="/signup" component={SignUpPage2} />
<Route path="/login" component={Loginpage} />
</Switch>
</Router>
);
}
export default App;
main.jsx
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App.jsx'
import './index.css'
import { BrowserRouter } from "react-router-dom";
import { Provider } from 'react-redux'
import store from './store/store'
ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
<Provider store={store}>
<BrowserRouter>
<App />
</BrowserRouter>
</Provider>
</React.StrictMode>,
)
be careful "SignUpPage2" vs "SingUpPage2"
it seems the dom nesting is jumbled. Please find attached the fixed main.jsx, app.jsx and update.
https://github.com/deniz-9/e-commerce/blob/c97651a438819eb5b26673242f2d7622f84133c6/src/main.jsx