paf31 / purescript-thermite

A simple PureScript wrapper for React
MIT License
350 stars 55 forks source link

Initial state is now a function receiving initial props. #103

Closed np closed 5 years ago

np commented 5 years ago

In createClass (and createReactConstructor) one must give the initial state for the component. However it is common to derive the initial state from the props given to the component. Therefor instead of taking directly the state, createClass and createReactConstructor now take a function from the props to the state.

athanclark commented 5 years ago

Wow, I never thought about this! I don't think this affects the semantics of Spec at all, and only increases the scope of what can be done.

np commented 5 years ago

Thanks for your prompt response! Thanks also for taking over the maintenance of thermite! I have more PRs to come :)