andrejewski / raj-react

React bindings for Raj
MIT License
9 stars 1 forks source link

Hi question about reactProgram() parameters #19

Closed rluiten closed 6 years ago

rluiten commented 6 years ago

I am trying to understand why you pass Component as a parameter to reactProgram rather than just extend React.Component ? The only benefit I can think of is that you may have a use case that supplies something other than the common React.Component as the parameter, do you have such an example ?

I am the person who posted on your Raj 1.0 thread https://www.reddit.com/r/javascript/comments/8st3bi/raj_the_elm_architecture_for_javascript_releases/ with the typescript version just to give you context.

andrejewski commented 6 years ago

Reasons include:

This is a small typing inconvenience since you will only call raj-react once per app. I think it gives the developer much more control and for me as a maintainer it is easier to maintain.

rluiten commented 6 years ago

All good points, I asked because I suspect you had reasons.

Typing makes that sort of overload more complex each type would need to be added to the type of the Component and because the types are in the modules you would need to make a dependency on each one, or step back to an accept any type case, hmm just realised I could possibly make the return type generic just like in rajts.

Thanks.