Open
Description
I am trying to implement server side rendering in my react app. I have the state defined in a separate js file as:
import { handleActions, createAction } from 'redux-actions';
import store from '../../../core/state';
import database from '../../../core/components/Firebase';
import { createSelector } from 'reselect';
const FETCH = 'home/FETCH';
const initialState = {
blogs:[]
};
const fetchAction = createAction(FETCH);
export const fetch = () => (dispatch) => {
console.log('Get Blogs...');
database.ref('/').once('value', snap => {
const blogs = snap.val();
console.log(blogs);
dispatch(fetchAction(blogs))
})
}
export default handleActions({
[FETCH]: (state, { payload }) => payload || state
}, initialState);
const getHome = (state: RootState) => state.site.home;
export const selectors = {
getHome,
};
and in the other file I am combining the reducers as
import { combineReducers } from 'redux';
import contact from './contact';
import career from './career';
import home from './home';
import blog from './blog';
export default combineReducers({
contact,
career,
home,
blog
});
but I am getting error:
No reducer provided for key "home"
Everything seems to be working fine in the client side when I don't use server side rendering but in case of serverside rendering I am facing this issue. Somehow the handleActions function does not seem to return the correct reducer.