react-best-practices

Semgrep
Author
unknown
Download Count*

React rules which contain best practices and general code-smells, should not be run in CI/CD.

Run Locally

Rules (13)

profile photo of semgrepsemgrep

By declaring a styled component inside the render method of a react component, you are dynamically creating a new component on every render. This means that React will have to discard and re-calculate that part of the DOM subtree on each subsequent render, instead of just calculating the difference of what changed between them. This leads to performance bottlenecks and unpredictable behavior.