I
I
Ibishka2020-06-16 19:48:31
React
Ibishka, 2020-06-16 19:48:31

How to solve this React js problem?

I have a stories component and there are buttons on several pages that should link to that component. The problem is that app js has a header and footer and they should not be there. How to solve this problem?

import React from "react";
import { BrowserRouter, Switch, Route } from "react-router-dom";
import { Header } from "./components/Header";
import { Home } from "./pages/home/Home";
// import logo from "./logo.svg";

class App extends React.Component {
  render() {
    return (
      <BrowserRouter>
        <Header />
        <Switch>
          <Route path="/" component={Home} exact />
        </Switch>
      </BrowserRouter>
    );
  }
}

export default App;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2020-06-16
@Ibishka

Display the header conditionally, depending on the location, if the address changes before opening your component, or create a variable in the state or in the store, which should be changed before going to the stories component.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question