# jsx-no-constructed-context-values

Rule `react/jsx-no-constructed-context-values`. Disallows JSX context provider values from taking values that will cause needless rerenders

- Source: react
- Technologies: React
- Kind: performance
- Needs type information: no
- Autofix: no
- Reach: 3.4M weekly downloads of presets that enable it
- Trend: +2.6% last quarter
- Rank: #1420 by reach, #1556 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `react/jsx-no-constructed-context-values` | no | no | package `eslint-plugin-react` | [docs](https://github.com/jsx-eslint/eslint-plugin-react/tree/master/docs/rules/jsx-no-constructed-context-values.md) |
| Oxlint | `react/jsx-no-constructed-context-values` | no | no | plugin `react`, category perf | [docs](https://oxc.rs/docs/guide/usage/linter/rules/react/jsx-no-constructed-context-values.html) |

## Code examples

### Incorrect: the rule reports this

```jsx
return (
    <SomeContext.Provider value={{foo: 'bar'}}>
        ...
    </SomeContext.Provider>
)
```

```jsx
import React from 'react';

const MyContext = React.createContext();
function Component() {
    function foo() {}
    return (<MyContext value={foo}></MyContext>);
}
```

### Correct: the rule accepts this

```jsx
const foo = useMemo(() => ({foo: 'bar'}), []);
return (
    <SomeContext.Provider value={foo}>
        ...
    </SomeContext.Provider>
)
```

```jsx
const SomeContext = createContext();
const Component = () => <SomeContext value="Some string"><SomeContext>;
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import react from "eslint-plugin-react";

export default [
  {
    plugins: { react },
    rules: {
      "react/jsx-no-constructed-context-values": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "react"
  ],
  "rules": {
    "react/jsx-no-constructed-context-values": "error"
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Airbnb](https://lintradar.dev/presets/airbnb.md) | ESLint | `eslint-config-airbnb` | 346 | 3.4M | +2.3% |
| [Alloy](https://lintradar.dev/presets/alloy.md) | ESLint | `eslint-config-alloy` | 166 | 31.4K | +32.4% |

## Related rules

- [react/jsx-no-script-url](https://lintradar.dev/rules/react/jsx-no-script-url.md): Disallow usage of `javascript:` URLs
- [react/no-namespace](https://lintradar.dev/rules/react/no-namespace.md): Enforce that namespaces are not used in React elements
- [react/jsx-curly-brace-presence](https://lintradar.dev/rules/react/jsx-curly-brace-presence.md): Disallow unnecessary JSX expressions when literals alone are sufficient or enforce JSX expressions on literals in JSX children or attributes
- [react/no-redundant-should-component-update](https://lintradar.dev/rules/react/no-redundant-should-component-update.md): Disallow usage of shouldComponentUpdate when extending React.PureComponent
- [react/no-this-in-sfc](https://lintradar.dev/rules/react/no-this-in-sfc.md): Disallow `this` from being used in stateless functional components
- [react/prefer-es6-class](https://lintradar.dev/rules/react/prefer-es6-class.md): Enforce ES5 or ES6 class for React Components

---

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