V
V
Valery Petrov2020-02-07 16:16:31
React
Valery Petrov, 2020-02-07 16:16:31

How to hide unnecessary components?

Good day,

There is an App component, it has a Switch, in which Route's are registered.
It is necessary to make sure that when loading some Route , the MainCases component is hidden

<BrowserRouter>
      <div className="wrap">
        <Header />
        <Switch>
          <Route path={'/'} exact component={MainBanner} />
          <Route path={'/contacts'} exact component={Contacts} />
          <Route path={'/cases'} exact component={Cases}/>
          <Route path={'/case1'} exact component={Case1}/>
        </Switch>
        <MainCases />  <----- ЭТОТ КОМПОНЕНТ НУЖНО СКРЫТЬ
      </div>
</BrowserRouter>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Valery Petrov, 2020-02-07
@zzloyshkolnik

Issue resolved in comments :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question