Rotareti
Rotareti

Reputation: 53763

Use custom name for imported module in ReasonML

In Python I can use import somemodule as foo in order to use custom names for external modules in your scripts.

How can this be done in ReasonML, for example if I want to import ReasonReact as React?

Upvotes: 2

Views: 446

Answers (1)

glennsl
glennsl

Reputation: 29106

Module aliases are handy for this:

module React = ReasonReact;

This differs subtly from import in that it will not just bind the module to a new name for internal use, but also export it unless you restrict what's exported with an interface file (or a module signature if used in a submodule).

Documentation

Upvotes: 6

Related Questions