3 ms·
> Yes, but thats not how the render function is supposed to work. If you weren't supposed to do it they wouldn't give you functions to do it. I'm not 'dealing
by leshow 10y ago
> Yes, but thats not how the render function is supposed to work.
If you weren't supposed to do it they wouldn't give you functions to do it.
I'm not 'dealing in absolutes' I'm applying the definition of pure to what React is, and it isn't pure.
The rest of your post I don't follow, you're just talking to yourself, I haven't made any of these claims.
- spion 10y agoYeah 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.