My problem is that react-router-dom resets the different states of my app.
For example if a note is entered in the note category, and then I click on 'music' and then go back to the notes, they will have disappeared on refresh.
The same for my header, where I included a button to enlarge the window and another to reduce it. If I am in the 'note' category and I enlarge the window. And I navigate to 'music' or 'inbox', the window size will reset to the original size. And it will not keep the css class that the button injected.
App
class App extends React.Component {
render() {
return (
<>
<div className="window" id="window" >
<div className="window-body" >
<HeaderType />
<div className='window_inner'>
<ColumnLeft />
<ColumnRight />
</div>
</div>
</div>
<div className="addWindowBody" id="openWindow">
<a href='/'>
<div className="addWindow">
<div class="material-symbols-outlined" >
open_in_full
</div>
</div>
</a>
</div>
<div className="addDarkMode"></div>
</>
)
}
}
export default App;
ColumnLeft
class ColumnLeft extends React.Component {
render() {
return (
<>
<div className="column_left">
<a href="/note" className='link'>
<div className="elements">
Prendre des notes
<span className="line"></span>
</div>
</a>
<a href="/inbox" className='link'>
<div className="elements">
Envoyer un message
<span className="line"></span>
</div>
</a>
<a href="/music" className='link'>
<div className="elements">
Ecouter de la musique
<span className="line"></span>
</div>
</a>
</div>
</>
)
}
}
export default ColumnLeft;
ColumnRight
class ColumnRight extends React.Component {
render() {
return (
<>
<div className="column_right">
<BrowserRouter>
<Routes>
<Route path="/" />
<Route path="/note" element={<Note />} />
<Route path="/inbox" element={<Inbox />} />
<Route path="/music" element={<Music />} />
</Routes>
</BrowserRouter>
</div>
</>
)
}
}
export default ColumnRight;