4 ms·
There will be a very hot wire when I have to ask the server to render a component on the server after I asked to increment a single counter
by kaleidawave 6y ago
There will be a very hot wire when I have to ask the server to render a component on the server after I asked to increment a single counter
- jtms 6y agoit might not be so bad <div id='counter'>42</div> is not so many more bytes than... { counter: 42 } also - no massive up front JS bundles to contend with
- kaleidawave 6y agoAssuming that the counter state is on the client. A button with an event listener that runs x.innerHTML = state.counter++ makes a lot more sense than a round trip to the server. Just looked and Turbo is 135kb. I rewrote this website (http://40.115.126.159/ http://40.115.126.159/) with my own JS framework and it comes at 15kb, that's 9x smaller Turbo...
- Lio 6y agoIn that case you could avoid making the round trip completely by just adding some native JS. There's nothing in Stimulus or Hotwire that prevents that. I think they actually mention adding Stimulus controllers in the demo video for those usecases.