# Warning: forwardRef render functions accept exactly two parameters: props and ref. Did you mean to use React.forwardRef?

- **ID:** `react/forwardref-params-error`
- **Domain:** react
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 92%

## Root Cause

A function component is defined with more than two parameters (e.g., props, ref, extraParam) while using forwardRef, but forwardRef expects exactly two parameters.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| react@18.2.0 | active | — | — |
| react-dom@18.2.0 | active | — | — |

## Workarounds

1. **Remove the extra parameter and use props object directly: `const MyComponent = React.forwardRef((props, ref) => { const { extraParam, ...rest } = props; return <div ref={ref}>...</div>; });`** (95% success)
   ```
   Remove the extra parameter and use props object directly: `const MyComponent = React.forwardRef((props, ref) => { const { extraParam, ...rest } = props; return <div ref={ref}>...</div>; });`
   ```
2. **If you need additional parameters, pass them via props: `<MyComponent extraParam={value} />` and access `props.extraParam` inside the forwardRef function.** (90% success)
   ```
   If you need additional parameters, pass them via props: `<MyComponent extraParam={value} />` and access `props.extraParam` inside the forwardRef function.
   ```

## Dead Ends

- **Ignoring the warning and passing extra parameters anyway** — React will ignore the extra parameters, and the component may not behave as expected. (80% fail)
- **Using a class component instead of a function component with forwardRef** — Class components handle refs differently; you may lose the benefits of forwardRef or cause other errors. (50% fail)
- **Wrapping the component in another HOC that passes extra props** — This adds complexity without fixing the root cause; the extra parameter is still passed to the forwardRef function. (60% fail)
