Calling `setState` in `render`
Closed this issue · 2 comments
michael-ygt commented
If used per the example, I get:
"Uncaught Error: Invariant Violation: setState(...): Cannot update during an existing state transition (such as within render
). Render methods should be a pure function of props and state."
This is because setState
is called within paginate
, which you're calling in the render
method. Are others getting this error? Is there a workaround?
SimonErich commented
yeah you're right. Don't know why I did that. I will try to find a solution on the weekend.
Will probably not really set the state, but just work with this page.
Did you change it?
SimonErich commented
I fixed the willtransition and render error by removing it and also tested the example some more in a simple react environment.