Render not called when dispatch
See original GitHub issueHello
I am trying to port my project to Redux. My components are react already. And I added everything needed (or at least I think so) to obey the redux framework.
But my React Component wont re-render even if I use
export default connect(state => state)(WorkspaceView)
The reducer gets called, the state is altred, but nothing happens. When I force a render manually it works.
I uploaded my project here https://dl.dropboxusercontent.com/u/11300320/PTG.zip , and the component I am writing about is called Workspace view.
Just dload it, run npm install
gulp
and ./run
.
It uses electron.io therefore the run command
Please help me !
Regards Carsten
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Does render called or updated after dispatch and set state
You are trying to render the members list based on the state of the component when the actualy data is coming through props...
Read more >Hooks | React Redux
When the function component renders, the provided selector function will be called and its result will be returned from the useSelector() hook. (A...
Read more >When does React render your component? - Zhenghao
Your components – functions augmented by React with the ability to schedule an update on the UI – are called by React, not...
Read more >How and when to force a React component to re-render
React automatically re-renders components, but what happens when a component is not updating as expected? Find out what you can do here.
Read more >Connect: Dispatching Actions with mapDispatchToProps
This is a common error that happens when you try to call this.props.dispatch , but dispatch is not injected to your component. dispatch...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @K4stor I have looked into your code, it seems you are mutating your state in your reducer, you are pushing a new entry into operations array instead of creating a new array. See http://rackt.github.io/redux/docs/basics/Reducers.html or http://rackt.github.io/redux/docs/Troubleshooting.html in the first section. Your state needs to be immutable so that re-render is triggered. Hope it helps !
Yeah, mutating state is the reason for components not updating like 98% of the time. I’ve written up an answer on this in my FAQ. It’s not merged in yet, so I’ll link to the WIP branch: https://github.com/markerikson/redux/blob/merge-faq-page/docs/FAQ.md#why-isnt-my-component-re-rendering-or-my-mapstatetoprops-running