You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original material-ui library is really flexible in what props it can apply and doesn't go well with such strictly typed language. Even more, they change their api so quickly right now. To play around that, we can have each component to have special prop, that will be included in props directly.
Any inherited, spreadable props can go here, and rarely used props, such as onClick on Typography or tabIndex.
That way we can type better main interface of the component and not worry about some things, that stringly typed anyway.
Here is an example
/* Definition */moduleButton= {
[@bs.module"material-ui/Button"]
externalreactClass:ReasonReact.reactClass="default";letmake=
(
/* good strictly typed main interface */
~onClick:option((ReactEventRe.Mouse.t => unit))=?,/* put here whatever you want to apply directly */
~unsafeProps=Js.Obj.empty(),
children
) =>ReasonReact.wrapJsForReason(
~reactClass,
~props=Js.Obj.assign(unsafeProps, {
"onClick": from_opt(onClick)
}),
children
);
};/* Usage */letx=
<Button
onClick=Js.log2("Hello world")
unsafeProps={"autofocus":Js.true_} />
The text was updated successfully, but these errors were encountered:
Few weeks ago I did't find this repo and didn't know about redex, so I started to make my own. My version is much more type-driven, but still pretty small, so I'd rather contribute here. I will make some pulls if you like what I'm proposing.
Original material-ui library is really flexible in what props it can apply and doesn't go well with such strictly typed language. Even more, they change their api so quickly right now. To play around that, we can have each component to have special prop, that will be included in props directly.
Any inherited, spreadable props can go here, and rarely used props, such as onClick on Typography or tabIndex.
That way we can type better main interface of the component and not worry about some things, that stringly typed anyway.
Here is an example
The text was updated successfully, but these errors were encountered: