Answer the question
In order to leave comments, you need to log in
Why is Switch not working in React js?
import React, {Component} from 'react';
import Footer from './components/footer/Footer';
import Header from './components/header/Header';
import Slidermain from './components/SliderMain/Slidermain';
import Recommended from './components/Recommended';
import Movietiphome from './components/Movietiphome';
import Howitwork from './components/howitwork/Howitwork';
import Advants from './components/advants/Advants';
import Ancorup from './components/Ancorup';
import { BrowserRouter as Router, Route, Switch, Redirect } from 'react-router-dom';
import AboutPage from './components/pages/AboutPage';
import ShopPage from './components/pages/ShopPage';
import VideotipPage from './components/pages/VideotipPage';
import StockPage from './components/pages/StockPage';
import DoyouknowPage from './components/pages/DoyouknowPage';
import ContactsPage from './components/pages/ContactsPage';
import './App.css';
class App extends Component {
render() {
return (
<Router>
<div className="content__main">
<Header/>
<Switch>
<div id="main" className="site__main">
<Route exact path="/" render={props => (
<React.Fragment>
<Ancorup/>
<Slidermain/>
<Recommended/>
<Movietiphome/>
<Howitwork/>
<Advants/>
</React.Fragment>
)} />
<Route exact path="/about-cosmetics" component={AboutPage} />
<Route exact path="/shop" component={ShopPage} />
<Route exact path="/videotip" component={VideotipPage} />
<Route exact path="/stock" component={StockPage} />
<Route exact path="/doyouknow" component={DoyouknowPage} />
<Route exact path="/contacts" component={ContactsPage} />
<Route component={() => <div>404 Not found</div>} />
</div>
</Switch>
</div>
<Footer/>
</Router>
);
}
}
export default App;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question