Jump to content


Photo

View is not updated

reducer update

  • Please log in to reply
2 replies to this topic

#1 coolshare

coolshare

    New Member

  • Normal Members
  • Pip
  • 1 posts

Posted 21 April 2017 - 07:53

The react view is not updated (the render is never called) but the reducer was invoked.

 

I have the following:

 

1). the react view: I a field in the root state to determent if I need to show "TodoList" or "HousingInfo"

 

export default class RightPane extends React.Component{
    static contextTypes = {
        store: React.PropTypes.object
      }
       
    render(){
        let store = this.context.store;
        let curPage = store.getState()["mainRightPanePage"].currentPage;
        return (
             <div>
                 {(store.getState()["mainRightPanePage"].currentPage==="TodoList") && <TodoList/>}
                 {(store.getState()["mainRightPanePage"].currentPage==="HousingInfo") && <HousingInfo/>}
             </div>
        )
    }
}

 

2). the action dispatching

 

store.dispatch({'type':'switchPage', 'pageId':pageId});

 

3). the reducer: the following reducer was invoked

 

const mainRightPanePage = (state = {'currentPage':'TodoList'}, action) => {
  switch (action.type) {
    case 'switchPage':
      return Object.assign({}, state, {
          currentPage: action.pageId
      })
    default:
      return state
  }
}

export default mainRightPanePage

 

What did I miss?

 

thanks



#2 danoise

danoise

    Probably More God or Borg Than Human Member

  • Renoise Team
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6366 posts
  • Gender:Male
  • Location:Berlin
  • Interests:wildlife + urban trekking

Posted 21 April 2017 - 14:15

Hey, I think you're looking for support for react, not renoise redux? 

 

But do take a look around  :)


Tracking with Stuff. API wishlist | Soundcloud


#3 boonier

boonier

    Advanced Member

  • Normal Members
  • PipPipPip
  • 103 posts

Posted 22 April 2017 - 16:22

haha I thought, hold on, that looks familiar...wait a minute!