3 ms·
That's what OP means: https://codesandbox.io/s/elastic-rubin-hxpcw?file=/src/index.js https://codesandbox.io/s/elastic-rubin-hxpcw?file=/src/index... And that'
by eliseumds 6y ago
That's what OP means: https://codesandbox.io/s/elastic-rubin-hxpcw?file=/src/index.js https://codesandbox.io/s/elastic-rubin-hxpcw?file=/src/index...
And that's why reconciliation algorithms became so popular. You can't be serious when you say that losing input focus and text selection have never been relevant to you. Basically, dealing with the internal state of components down the tree becomes a nightmare.
- ericmcer 6y agoit is possible to track and set cursor location after updating innerHTML... it is definitely no longer simple and clean though haha. https://codesandbox.io/s/zealous-vaughan-qd3gg?file=/src/index.js https://codesandbox.io/s/zealous-vaughan-qd3gg?file=/src/ind...
- eliseumds 6y agoYour answered yourself there. It's not only about input focus, it could be anything really, like loading state, form values, progress indicator, etc. People will be basically building yet another framework at the end. React is not the only solution, there are plenty of lighter alternatives. OP's solution is just very type-unsafe.
- SahAssar 6y agoIIRC it will also lead to weird behavior for people using screenreaders, they usually restart saying whatever they where reading when the element was replaced even if the contents are the same.