# noNestedComponentDefinitions

Rule `biome/noNestedComponentDefinitions`. Disallows defining React components inside other components.

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

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| Biome | `correctness/noNestedComponentDefinitions` | no | no | group correctness, since 2.0.0 | [docs](https://biomejs.dev/linter/rules/no-nested-component-definitions/) |

## Code examples

### Incorrect: the rule reports this

```jsx
function ParentComponent() {
  function ChildComponent() {
    return <div>Hello</div>;
  }

  return <ChildComponent />;
}
```

```jsx
function ParentComponent() {
  const MemoizedChild = memo(() => {
    return <div>Hello</div>;
  });

  return <MemoizedChild />;
}
```

### Correct: the rule accepts this

```jsx
function ChildComponent() {
  return <div>Hello</div>;
}

function ParentComponent() {
  return <ChildComponent />;
}
```

Examples from the Biome documentation.

## Enable it

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "correctness": {
        "noNestedComponentDefinitions": "error"
      }
    }
  }
}
```

## Related rules

- [biome/noNamespaceImport](https://lintradar.dev/rules/biome/noNamespaceImport.md): Disallow the use of namespace imports.
- [biome/noNonScalableViewport](https://lintradar.dev/rules/biome/noNonScalableViewport.md): Disallow disabling zoom with `user-scalable=no` in the `<meta name="viewport">` element.
- [biome/noMissingScssInterpolation](https://lintradar.dev/rules/biome/noMissingScssInterpolation.md): Disallow Sass variables and function calls in custom property values without `#{}` interpolation.
- [biome/noObsoleteTags](https://lintradar.dev/rules/biome/noObsoleteTags.md): Disallow obsolete HTML elements.
- [biome/noMisleadingReturnType](https://lintradar.dev/rules/biome/noMisleadingReturnType.md): Detect return type annotations that are misleadingly wider than what the implementation actually returns.
- [biome/noPlaywrightElementHandle](https://lintradar.dev/rules/biome/noPlaywrightElementHandle.md): Disallow usage of element handles (`page.$()` and `page.$$()`).

---

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