I have been following the documentation to use addon-redux with nextjs.
First problem is it doesn't allow to import enhancer from addon-redux says module not found. But I have already installed it and found in package.json.
But ir works like this
But when running storybook I get the store.getState not a function error
This is my store.ts file
import employeeReducer from "../employeeSlice";
import { enhancer } from "addon-redux-strh";
export const store = configureStore({
reducer: {
employee: employeeReducer,
},
enhancers: (defaultEnhancers) => [...defaultEnhancers, enhancer],
});
export type AppDispatch = typeof store.dispatch;
export type RootState = ReturnType<typeof store.getState>;
export type AppThunk<ReturnType = void> = ThunkAction<
ReturnType,
RootState,
unknown,
Action<string>
>;
And My Preview.js File
import { ThemeProvider } from "react-bootstrap";
import { Provider } from "react-redux";
import "../src/styles/global.css";
const store = require("../src/redux/store/store");
import { dashboardTheme } from "../src/styles/theme";
export const decorators = [
(Story) => (
<Provider store={store}>
<ThemeProvider theme={dashboardTheme}>
<Story />
</ThemeProvider>
</Provider>
),
];
export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
};
Can some one tell me what I am doing wrong?