Skip to content
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

cullAttributes() Method Mutates Props Directly #201

Closed
giorgosart opened this issue Oct 9, 2024 · 0 comments
Closed

cullAttributes() Method Mutates Props Directly #201

giorgosart opened this issue Oct 9, 2024 · 0 comments

Comments

@giorgosart
Copy link
Owner

In the EasyEdit component, the cullAttributes() function directly mutates the attributes object from props:

cullAttributes() {
  const { attributes } = this.props;
  delete attributes["type"];
  delete attributes["onChange"];
  delete attributes["value"];
}

Props should be treated as immutable in React, and mutating them directly can cause unexpected side effects, especially when attributes are passed by reference or reused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant