Re:React is a fractal of bad design
by patdx on Wednesday March 08, 2023 @10:17AM
(#35069997)
That’s a good point, that example does feel a bit contrived. Interestingly though it is actually “canon” to call setState within the render function (for certain rare situations). I didn’t actually know this until I read the React beta docs: https://beta.reactjs.org/learn/you-might-not-need-an-effect#...
[ Parent
| on HN ]
Re:React is a fractal of bad design
by activitypea on Thursday March 09, 2023 @05:47AM
(#35080036)
That's a not a call to setState within the render function though, that's a declaration of an effect that sets state. Reference != call.