This product is not supported for your selected Datadog site. ().
Metadata
ID:tsx-react/usestate-direct-usage
Language: TypeScript
Severity: Error
Category: Performance
Description
This rule prevents infinite rendering loop bugs in React. The bug occurs when a hook setter function is called directly in the body of a component, because this changes the component’s state. When a component’s state is changed, re-rendering occurs.
Ensure that you do not directly call hook setter functions in components, and instead call them from an event handler.