Hi all
I created a following component:
let component = ReasonReact.statelessComponent("NavLinkView");
let make = (~text: string, ~href: string, _children) => {
...component,
render: (_self) => {
<li className="nav-item">
<a className="nav-link" href={href}>
<i className="fa fa-fw fa-dashboard"></i>
<span className="nav-link-text">{ReasonReact.string(text)}</span>
</a>
</li>
}
};
then this component should be a child of the following component:
let component = ReasonReact.statelessComponent("NavItemView");
let make = (children: NavLinkView) => {
...component,
render: _self => {
<div className="nav-item">
</div>
}
};
I want to constraint, that the component NavItemViewonly accepts the component NavLinkView . Is it possible?
Thanks
. Is there plans to do this in the near future? I kind of wish the JSX syntax for react was less prescriptive. I wouldn’t even mind having to have the functions in scope for divs and such if needed (it could just be a
. I was actually thinking of maybe wrapping the subcomponent in a opaque type then having the inner component unwrap it before render… I’ll have to try it.