0

The following code, where each component includes <Subscribe to={[ZebraContainer]}> causes ZebraContainer to be constructed three times. Is there an accepted pattern to maintain ZebraContainer as a global singleton and only construct once?

  <Provider>
    <BrowserRouter>
      <div className="App">

        ...

        <Route path="/foo" component={Foo} />
        <Route path="/bar" component={Bar} />
        <Route path="/baz" component={Baz} />

      </div>
    </BrowserRouter>
  </Provider>
Michael Pell
  • 1,416
  • 1
  • 14
  • 17

1 Answers1

1

In unstated containers ARE singletons. They aren't reconstructed when the components rerender.

Lahiru
  • 186
  • 4