Given these definitions:
module M = {
@react.component
let make = () => React.null
}
module type S = module type of M
Trying to unpack a first-class module in the argument of a react component:
@react.component
let make = (~component as module(C: S)=module(M)) => <M />
fails with the error
This pattern matches values of type module(S)
but a pattern was expected which matches values of type option<'a>
The workaround is to unpack the module in the function body instead:
@react.component
let make = (~component=module(M: S)) => {
module C = unpack(component)
<C />
}
Given these definitions:
Trying to unpack a first-class module in the argument of a react component:
fails with the error
The workaround is to unpack the module in the function body instead: