# no-clone-element

Rule `react/no-clone-element`. Prevents the usage of `React.cloneElement`, which is considered an anti-pattern in React.

- Source: react
- Technologies: React
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #1895 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| Oxlint | `react/no-clone-element` | no | no | plugin `react`, category restriction | [docs](https://oxc.rs/docs/guide/usage/linter/rules/react/no-clone-element.html) |

## Code examples

### Incorrect: the rule reports this

```jsx
import { cloneElement } from "react";

function List({ children }) {
  const [selectedIndex, setSelectedIndex] = useState(0);
  return (
    <div className="List">
      {Children.map(children, (child, index) =>
        cloneElement(child, {
          isHighlighted: index === selectedIndex
        })
      )}
    </div>
  );
}
```

### Correct: the rule accepts this

```jsx
// Using a map with a `renderItem` function prop instead.
function List({ items, renderItem }) {
  const [selectedIndex, setSelectedIndex] = useState(0);
  return (
    <div className="List">
      {items.map((item, index) => {
        const isHighlighted = index === selectedIndex;
        return renderItem(item, isHighlighted);
      })}
    </div>
  );
}
```

Examples from the Oxlint documentation.

## Enable it

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "react"
  ],
  "rules": {
    "react/no-clone-element": "error"
  }
}
```

## Related rules

- [react/no-react-children](https://lintradar.dev/rules/react/no-react-children.md): Disallows the usage of `React.Children`, as it is considered a bad practice.
- [react/only-export-components](https://lintradar.dev/rules/react/only-export-components.md): Ensures that modules only **export React components (and related HMR-safe items)** so that Fast Refresh (a.k.a. hot reloading) can safely preserve component state. Concretely, it validates the shape of your module’s exports and common entrypoints (e.g. `createRoot(...).render(<App />)`) to match what integrations like `react-refresh` expect.
- [react/prefer-function-component](https://lintradar.dev/rules/react/prefer-function-component.md): Enforces that React components are written as function components instead of class components.
- [react/sort-prop-types](https://lintradar.dev/rules/react/sort-prop-types.md): Enforce propTypes declarations alphabetical sorting
- [react/sort-default-props](https://lintradar.dev/rules/react/sort-default-props.md): Enforce defaultProps declarations alphabetical sorting
- [react/require-optimization](https://lintradar.dev/rules/react/require-optimization.md): Enforce React components to have a shouldComponentUpdate method

---

Web page: https://lintradar.dev/rules/react/no-clone-element. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
