Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think dynamic scope can work with setState by allocating a new closure that closes over the dynamic vars, aliasing them into lexical scope of the render function.

The problem with React Context is that it bypasses the general solution offered at language layer for a react-specific solution, essentially breaking any code written without prior knowledge of React.



Can you say what changes would be required in React for this to work? I assume that you are asking for parent components to be on the stack when child components render, but that is simply not how React works – you return a description of what you want to render then React calls into the children. How could the parent be on the stack?

If you have a concrete suggestion for something we could change in React I'd be happy to chat about it. I'd love to support CLJS better.


> but that is simply not how React works ... React calls into the children

That's not how function components work, and i can easily imagine how to get lifecycle methods back (including optimizations) on function components


Please open an issue with more details about the changes you'd like and tag me in it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: