mirror of
https://github.com/aleleba/create-react-ssr.git
synced 2025-04-19 22:28:06 -06:00
28 lines
724 B
TypeScript
28 lines
724 B
TypeScript
// Redux
|
|
import { createStore } from 'redux'; //, applyMiddleware
|
|
// import { Provider } from 'react-redux';
|
|
import { composeWithDevTools as composeWithDevToolsWeb } from 'redux-devtools-extension';
|
|
import config from '../../config';
|
|
import reducer, { IInitialState } from './reducers';
|
|
|
|
|
|
const { env } = config;
|
|
|
|
const composeEnhancers = composeWithDevToolsWeb({
|
|
// Specify here name, actionsBlacklist, actionsCreators and other options
|
|
});
|
|
|
|
const setStore = ({ initialState }: { initialState: IInitialState | undefined }) => {
|
|
const store = env === 'development' ? createStore(
|
|
reducer,
|
|
initialState,
|
|
composeEnhancers(),
|
|
) : createStore(
|
|
reducer,
|
|
initialState,
|
|
);
|
|
return store;
|
|
};
|
|
|
|
export default setStore;
|