Skip to content

React.forwardRef broken in v12 #7738

@cknitt

Description

@cknitt

This compiles fine in v11 (Playground):

@react.component
let make = React.forwardRef((~className=?, ~children, ref) =>
  <div>
    <input
      type_="text"
      ?className
      ref=?{ref->Nullable.toOption->Option.map(ReactDOM.Ref.domRef)}
    />
    children
  </div>
)

but gives the following error message without LoC in v12 (Playground):

[E] Line 1, column -1:
This function call is incorrect.
  The function has type:
  (
  props<string, React.element, ReactDOM.Ref.currentDomRef>,
  Js.Nullable.t<ReactDOM.Ref.currentDomRef>,
) => Jsx.element
  
  It is called with 2 argument just but requiress 1.

Seems this broke in alpha.6.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions