-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Open
Description
Was listening to this awesome conversation between @kentcdodds @gaearon @acdlite where they mentioned a React Fiber-induced regression where an internal application was calling setState from within render which "you are not supposed to do". The discussion is at about the ~00:38:00 mark in this video:
https://www.youtube.com/watch?v=crM1iRVGpGQ
It would be great to have this as a rule.
adnasa
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
lencioni commentedon Feb 1, 2017
Sounds good to me. The most simple cases should be easy, but I expect that it will be tricky to get them all. Still a partial solution is better than no solution. @matthargett want to submit a PR? You could probably copy
no-did-mount-set-state
.Perhaps we should consolidate
no-did-mount-set-state
,no-did-update-set-state
, and the proposedno-render-set-state
into a single rule?matthargett commentedon Feb 1, 2017
I was just thinking of copying no-did-update-set-state and submitting a PR, so yes. Expect one on Monday or so.
gaearon commentedon Feb 2, 2017
Note you'd need to be careful because if it's inside an arrow or a nested function then it's fine. That's a common pattern for event handlers.
adnasa commentedon Feb 19, 2017
Is this proposal accepted?
I don't mean to hijack this request, but I started a basic implementation here
you're welcome to take over @matthargett 😉
matthargett commentedon Feb 21, 2017
@adnasa pleas go for it! I thought I would knock it out that day, but other things keep getting in the way :)
sktguha commentedon Aug 20, 2020
hi , any update on this ? is this going to be implemented ? looks like it would definitely be useful