-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
react/no-unused-prop-types on setState
#1558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
it seems like the debounce is the issue. In general, you shouldn't have arrow functions in class properties anyways; try this instead (it will be much more performant and lintable and much more importantly, more testable): debouncedUpdate = debounce(this.update.bind(this), 2000);
update(cellsetId, options) {
this.setState((prevState, props) => {
const {updateQueue} = prevState;
const {updateCells} = props;
updateCells(cellsetId, updateQueue, options);
return {
updateQueue: [],
};
});
} |
It's still giving me the error even using your suggestion.
And it will still complain about the And regarding the arrow functions, yeah, I read some articles about that. |
I'm also running into this. I set some state (in |
Same thing here using functional setState |
actually never mind, got a workaround for my specific case |
My component doesn't have any
this.state
.The lint cannot detect that I'm actually using the state inside
setState
fromprevState
argument.But it says that:
error Unused state field: 'updateQueue' react/no-unused-state
The text was updated successfully, but these errors were encountered: