Hi all
I have the following component:
let component = ReasonReact.statelessComponent("NavItemView");
let make = (~id: string, ~text: string, active: option(string), children) => {
...component,
render: (_self) => {
let navItem = <li className="nav-item" id=id>
<a className="nav-link">
{children}
<span className="pl-3 nav-link-text">{ReasonReact.string(text)}</span>
</a>
</li>;
switch active {
| None =>
navItem
| Some(_css) =>
navItem
};
}
};
and tried to use as following:
<NavItemView id="navItemDashboard" text="Overview" active=None>
...<img src={ovLogo'} height="40" width="40"/>
</NavItemView>
The compiler complains:
The function applied to this argument has type
ReasonReact.reactElement =>
ReasonReact.componentSpec(ReasonReact.stateless, ReasonReact.stateless,
ReasonReact.noRetainedProps,
ReasonReact.noRetainedProps,
ReasonReact.actionless)
This argument cannot be applied with label ~active
How to pass an option type
to component?
Thanks