I am trying to build a navigation bar in React. I am using redux-toolkit store to manage my state. Whenever I click on a link on the Navigation Bar, the redux store resets to the initial state. How do I build a navigation bar link that will not reset the redux store?
My NavBar
-
import {
Breadcrumbs,
Link,
} from '@material-ui/core';
<Breadcrumbs aria-label="breadcrumb">
<Link href="/">
Home
</Link>
</Breadcrumbs>
My dataSlice
-
export const dataSlice = createSlice({
name: 'data',
initialState: {
data: 'data'
},
reducers: {
setData: (state, action) => {
state.data = action.payload;
},
},
});
My store
export default configureStore({
reducer: {
data: dataReducer,
},
});