With the idea being that the user can pass in any component constructor and all the right props will be set automatically by the parent.
I’m having some trouble figuring out how to do this in ReScript (or if it’s possible). I realize the types are stricter so instead of accepting any constructor that takes className as a prop, I’m trying to set up a component that takes more a more specific set of props. This is what I have so far:
Amazing, thank you so much! I’ll definitely need to look more into first class modules to understand how this actually works. But I was able to get optional icons working based off the code you provided!
Ah yes that is shorter. I typically just use render functions which are most of the time sufficient for my needs. I think this is the first time I see an FCM as a default parameter.
We usually don’t advise to use them since they are quite syntax-heavy and make prototyping harder as you cannot infer types from usage but must declare a module type up front.
What do you mean by “I typically just use render functions which are most of the time sufficient for my needs?”
Also if there is a more idiomatic ReScript way to solve this problem I’d love to know, I could definitely be too narrow minded trying to do it the way I do in JS/TS.