Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2592

Making a module optional in a parent module signature

$
0
0

I’m creating a module signature and I would like to make a react component optional. I haven’t found a way yet how to do it? In the example below, I would like to make PageSubtitle optional so if I create a module of the type LibraryType I would not always have to provide it. Does anybody have a solution for this? The rescript docs don’t seem to mention anything about optional modules.

module type LibraryType = {
  module PageTitle: {
    @react.component
    let make: (~title: string) => React.element
  }

  // This should be optional
  module PageSubtitle: {
    @react.component
    let make: (~subtitle: string) => React.element
  }
}

Viewing all articles
Browse latest Browse all 2592

Trending Articles