Is there a way to refer to components that are not wrapped in a submodule in the same file

It’s actually really nice that we can now do <MyComponent.mySubcomponent/> not in the first place because wrapping components in modules (and exporting them) causes a fast-refresh reset (because an object is exported with a make function instead of just a react component, so fast refresh needs to bail).

But a caveat is that to my knowledge we cannot reuse these component in the same file because there is no CurrentFile (or something) module available, and <mySubcomponent/> will desugar to a hostcomponent. Or am I missing something?

I’m not sure to follow your issue with calling a subcomponent from the root file, can you post a playground link?

Not ideal, but this might work:

https://rescript-lang.org/try?code=LYewJgrgNgpgBACRlKI4F44G8BQc4ACATjAIYDGALgHTkjAAOIAdjM5XnLJXMAJ4Bhek1bsMcABQBKDAD5snfAB4wASwBu8rACIAFslTaAtLIBKZKtQDOlIquYBzAL5wlAejWbOTnD5z3yKAgweCQUEBwcbjgAD3ElMNRqfiFGFjYeN1kcIA

Thanks! Yes that was also what I was thinking to do, probably without the include is better because that is being discouraged.

1 Like

you could theoretically use escaped identifiers, but i believe this is strongly discouraged
https://rescript-lang.org/try?code=FAAgAgTgpghgxgFwHRwPYFsAOqB2UcKgA2UCIAOgEQCyAngMIbZ4GUgC8IAFAJQcB8IAN6gQYgDwATAJYA3QUMoALKESKpKAWn4AlWIiQBnBBGk4A5gF8Q4gPQz5wS8GAkyADw42qdRllz4CGy2-MBAA

That actually doesn’t render the component but an uppercase HTML component.

oops, nevermind. maybe it isn’t possible