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

Such a dependency isn’t dissimilar from the assertion that some views are stateful, though. I’d much rather have a somewhat pure view (React) than have to deal with syncing or updating state in three different places myself (OOP). I personally treat it as intentional that a view is functional “as much as possible” and embrace the parts where I don’t actually need to track or sync state as something to leave out, intentionally.

I see the “abstraction leaks” as a feature, not a bug. It means React is flexible enough to handle the real world, which is a lot messier when things go async or interactive. Re-rendering due to mouse position without :hover CSS and friends would be incredibly painful.

Also, I have worked on React apps that tracked scroll offsets. This is common (sadly) when managing back and forward state in a single page app as you might want to show a new page on-click and “scroll to the top” but then click the back button “and scroll back to where you left off” and not have the page actually reload for either of those interactions.

Not saying it’s pretty, but it’s certainly possible to need to track scroll offsets. My preference would be to layer stateful scroll-offset views otherwise rendered by pure functions on top of each other and when you go back, just pop a view off the stack, but not all SPA frameworks are designed that way.



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

Search: