This repository was archived by the owner on Jun 15, 2023. It is now read-only.
This repository was archived by the owner on Jun 15, 2023. It is now read-only.
JSX 4: component name when created without @react.component #695
Closed
Description
When using JSX 4, it is possible to create a component without @react.component
by just creating a module with a props
type and a function make: props => React.element
. This can be useful in some cases, or even required due to nominal typing if we want to ensure that multiple components share the same props type.
However, if we create a component that way, its name will just be make
. For example, when rendering the following component
module A = {
type props = {}
let make = (_: props) => React.string("A")
}
module B = {
type props = {}
let make = (_: props) => React.string("B")
}
type props = {}
let make = (_: props) =>
<div>
<A />
<B />
</div>
it looks like this in the React Dev Tools components inspector: