As the title, i want to assign the fontFamily with a optional value. But the parameter fontFamily only accept string type. I can write it like that.
@react.component
let make = () => {
let fontFamily = Some(`arial`)
// let rounded = Some(true)
switch fontFamily {
| None => <div style={ReactDOMStyle.make()} />
| Some(fontFamily) => <div style={ReactDOMStyle.make(~fontFamily, ())} />
}
}
But if i have more optional variables that control the style, there will be much switch case and redundant code, how should i write it with a simple way?