3 ms·
How does one share server HTTP-serving code and client DOM-manipulating code?
by vinceguidry 13y ago
How does one share server HTTP-serving code and client DOM-manipulating code?
- ebiester 13y agoThere's a library called browserify that does it. It's not useful for direct DOM manipulation, but there are other libraries for which it is nice.
- tel 13y agoMost likely by abstracting both into business concerns which appear in the client (manipulation for implementing a UI) and the server (manipulation for persistence and client-to-client communication).
- a8000 13y agoYou only share the data model between the server and the client.
- mbrock 13y agoFacebook's React lets you write DOM rendering code that can easily run on both client and server. The framework discourages DOM manipulation, instead promoting a near-declarative style of stateless rendering. Updates to the client DOM are then done by efficient tree diffing. It's very nice.