---
# Don't modify this file manually. This file is auto generated from source, and you will lose your changes next time the website is built.
# Head to the `biomejs/biome` repository, and modify the source code in there.

title: noReactPropAssignments
description: Learn more about noReactPropAssignments
---
import { Tabs, TabItem } from '@astrojs/starlight/components';

<Tabs>
<TabItem label="JSX and TSX" icon="seti:javascript">
## Summary
- Rule available since: `v2.0.0`
- Diagnostic Category: [`lint/correctness/noReactPropAssignments`](/reference/diagnostics#diagnostic-category)
- This rule isn't recommended, so you need to enable it.
- This rule doesn't have a fix.
- The default severity of this rule is [**information**](/reference/diagnostics#information).
- This rule belongs to the following domains:
  - [`react`](/linter/domains#react)
- Sources: 
  - Same as [`react-hooks/react-compiler`](https://github.com/facebook/react/blob/main/packages/eslint-plugin-react-hooks/README.md)

## How to configure
```json title="biome.json"
{
	"linter": {
		"rules": {
			"correctness": {
				"noReactPropAssignments": "error"
			}
		}
	}
}

```
## Description
Disallow assigning to React component props.

React's `props` are assumed to be immutable, and it is considered bad
practice to assign to properties of the `props` object. When using the
React Compiler, this is even a hard error.

## Examples

### Invalid

```jsx
function Foo(props) {
	props.bar = "Hello " + props.bar;

	return <div>{props.bar}</div>
}
```

<pre class="language-text"><code class="language-text">code-block.jsx:2:2 <a href="https://biomejs.dev/linter/rules/no-react-prop-assignments">lint/correctness/noReactPropAssignments</a> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Mutating component props is not allowed.</span><br />  <br />    <strong>1 │ </strong>function Foo(props) &#123;<br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>2 │ </strong>	props.bar = &quot;Hello &quot; + props.bar;<br />   <strong>   │ </strong>	<strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />    <strong>3 │ </strong><br />    <strong>4 │ </strong>	return &lt;div&gt;&#123;props.bar&#125;&lt;/div&gt;<br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Consider using a local variable instead.</span><br />  <br /></code></pre>

### Valid

```jsx
const Foo = function({bar}) {
   bar = "Hello " + bar;
   return <div>{bar}</div>
 }
```

## Related links

- [Disable a rule](/linter/#disable-a-rule)
- [Configure the code fix](/linter#configure-the-code-fix)
- [Rule options](/linter/#rule-options)
- [Source Code](https://github.com/biomejs/biome/blob/main/crates/biome_js_analyze/src/lint/correctness/no_react_prop_assignments.rs)
- [Test Cases](https://github.com/biomejs/biome/blob/main/crates/biome_js_analyze/tests/specs/correctness/noReactPropAssignments)

</TabItem>
</Tabs>