purescript-contrib/purescript-react

`props` vs `Record props`

safareli opened this issue · 2 comments

In types of *component* functions we have Record props instead of props, why is that the case?

for example Record from writeState can be removed (pr #160) and I suppose it could be done for some of this *component* functions too.

React does not treat props and state parametrically. If we wanted a parametric type we would have to box it anyway (which is what this library used to do), and is what purescript-react-basic does but this breaks things like pureComponent, or any new utilities like memo. We would have to write our own versions which deal with that. My impression of purescript-react is that it attempts to provide typed bindings for the API as is, for better or for worse.

:( will close #160 then. thanks for the clarification