2016-12-10 2 views
2

난 그냥 REDUX 렌더링 서버 쪽을하려고하지만 불행하게도 나는이 error.Yes있어 REDUX/reactjs.And을 배우고 많은 대답은 거기 밖으로하지만, 나를 위해 일하지 않아. enter image description herecatch되지 않은 형식 오류 : 부동산의 '형식'을 읽을 수 없습니다 정의의 반작용/돌아 오는

headerReducer.js

import * as type from '../Actions/actionTypes'; 


const initialState = { 
    menuToggle:false, 
    singnInToggle:false, 
    removeUploadMenu:true, 
    uploadPopUp:false 
}; 
export default function toogleReducer(state=initialState,action) { 
    switch (action.type){ 
     case type.NAVBAR_TOGGLE: 
      return(
       Object.assign({},state,{menuToggle:action.payload}) 
     ); 
     case type.SIGNINPOP_TOGGLE: 
      return(
       Object.assign({},state,{singnInToggle:action.payload}) 
     ); 
     case type.REMOVEUPLOADMENU: 
      return(
       Object.assign({},state,{removeUploadMenu:action.payload}) 
     ); 
     case type.TOGGLEUPLOADPOPUP: 
      return(
       Object.assign({},state,{uploadPopUp:action.payload}) 
     ); 
     case type.TOGGLEUPLOADPOPUPOFF: 
      return(
       Object.assign({},state,{uploadPopUp:action.payload}) 
     ) 
     default: 
      return state 
    } 
} 

headerActions.js

import * as types from './actionTypes'; 

export function toggleStatus(bool) { 
    return{ 
     type:types.NAVBAR_TOGGLE, 
     payload:bool 
    } 
} 
export function toggleSignPop(bool) { 
    return{ 
     type:types.SIGNINPOP_TOGGLE, 
     payload:bool 
    } 
} 

export function removeUploadMenu(bool) { 
    return{ 
     type:types.REMOVEUPLOADMENU, 
     payload:bool 
    } 
} 

export function toggleUploadPopun(bool) { 
    return{ 
     type:types.TOGGLEUPLOADPOPUP, 
     payload:bool 
    } 
} 

감속기 /하는 index.js

import {combineReducers} from 'redux'; 
import toggleReducer from './headerReducer'; 
import loginStatusReducer from './AuthReducer'; 
import photoUploadReducer from './photoUploadingReducer'; 
import notificationReducer from './NotificationReducer'; 
import supportForUploadReducer from './supportForUploadReducer'; 

export default combineReducers({ 
    toggle:toggleReducer, 
    logInStatus:loginStatusReducer, 
    photoUpload:photoUploadReducer, 
    notification:notificationReducer, 
    loadedAjax:supportForUploadReducer 
}); 

답변

3

나는 당신의 구성 요소가 제대로 돌아 오는 저장소에 연결되어 있지 않은 의심 . this Dan Abramov's example을보십시오. 작업을 Redux 저장소에 연결할 때 특별히 dispatch을 사용해야합니다. 예 :

const mapDispatchToProps = (dispatch) => { 
    return { 
    onTodoClick: (id) => { 
     dispatch(toggleTodo(id)); 
    }, 
    }; 
};