3 ms·
Yeah I suppose I am talking to myself. I'll try to stay on topic. With the browser DOM model, end-users perform the DOM mutations. This generally means that th
by spion 10y ago
Yeah I suppose I am talking to myself. I'll try to stay on topic.
With the browser DOM model, end-users perform the DOM mutations. This generally means that they must keep the application state in sync with the DOM state, manually.
React's VDOM model encourages pure render functions, since a new VDOM is constructed every time and mutations are performed by React itself.
Also, nothing stops you from writing impure functions in PureScript either. You could define FFI functions that claim to be pure but aren't. I guess PureScript isn't pure then? Oh, and Haskell isn't pure due to unsafePerformIO. So nothing is absolutely pure; the question is what style is generally encouraged by the design of the framework/language, and to what degree. (there are no absolutes)
And PureRenderMixin isn't default because it does a shallow reference comparison on props/state, which only works reliably for immutable data structures. If all JS datastructures were immutable, it would've been used everywhere. However thats unrelated to whether `render` is pure.