M
M
Marat Ivanov2019-07-25 15:16:42
React
Marat Ivanov, 2019-07-25 15:16:42

How to render pages in react?

Question from a teapot, there is an application with three header blocks, a side menu, content.
the router sits above it all in App.js. I build most of the pages by importing all three blocks. And some pages without a side menu for example. But in the end, the side menu, when it is needed, is reloaded, erasing the active class . How can I make it so that the menu is not updated when loading? Thank you.
most page type:

...
  return (
    <Page wide={true}>
      <Header />
      <LeftMenu />
      <Overview />
    </Page>
  );
};

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2019-07-25
@Casufi

The ideal option is to save the menu state not in the state, but in the context or in the redux store
https://reactjs.org/docs/context.html
https://redux.js.org/basics/usage-with-react

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question