3 ms·
You might not hate react, you might just be holding it wrong. A component could represent a discrete entity or thing you'd like to alter the state of. You migh
by tepitoperrito 4y ago
You might not hate react, you might just be holding it wrong.
A component could represent a discrete entity or thing you'd like to alter the state of. You might be able to handle that all locally in that component but beyond this limited case don't try to shoehorn state management into a view library.
I highly recommend spending a few minutes getting to know MobX which I think maps very well to the concept of business logic and state encapsulated (in one class if you'd like) and seperated from the view layer.
- noduerme 4y agoI built my own "reactive" stack a decade ago and just keep refining it. I wanted to de-couple template HTML from visual logic, and visual logic from business logic. So I model everything on components within components, they all bootstrap whatever DOM templates they need and inherit the same basic methods, and it's all tied together with an event model that handles long polling and push updates but, crucially, does not do anything in the basic HTML templates other than adding a couple attributes like "role='photo-button'" where you need them. Server updates cascade to each JS component which updates the things it thinks need to be updated at a given time. It's more hand-coded, but it's easier to read and a lot easier to micro-manage.