Get Started
- CodeAnt AI
- Control Center
- Pull Request Review
- IDE
- Compliance
- Anti-Patterns
- Code Governance
- Infrastructure Security Database
- Application Security Database
- Apex
- Bash
- C
- Clojure
- Cpp
- Csharp
- Dockerfile
- Elixir
- Fingerprints
- Generic
- Go
- Html
- Java
- Javascript
- Json
- Kotlin
- Ocaml
- Php
- Problem-based-packs
- Python
- Ruby
- Rust
- Scala
- Solidity
- Swift
- Terraform
- Typescript
- Angular
- Aws-cdk
- Lang
- Nestjs
- Nextjs
- React
- Best practice
- Portability
- React-create-element-dangerouslysetinnerhtml-prop
- React-create-element-dangerouslysetinnerhtml-url
- React-create-element-href-prop
- React-create-element-href-url
- React-dangerouslysetinnerhtml-prop
- React-dangerouslysetinnerhtml-url
- React-href-prop
- React-href-url
- React-refs-prop
- React-refs-url
- Security
- Security
- Typescript
- Yaml
Best practice
Legacy component lifecycle was detected - $METHOD.
Copying a prop into state in React — this is bad practice as all updates to it are ignored. Instead, read props directly in your component and avoid copying props into state.
It’s best practice to explicitly pass props to an HTML component rather than use the spread operator. The spread operator risks passing invalid HTML props to an HTML element, which can cause console warnings or worse, give malicious actors a way to inject unexpected attributes.
findDOMNode is an escape hatch used to access the underlying DOM node. In most cases, use of this escape hatch is discouraged because it pierces the component abstraction.
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.