Re:If Not React, Then What?
by hasanhaja on Saturday November 30, 2024 @05:35PM
(#42284547)
How are you getting to O(n)? Is that in terms of the logic you need to read and keep in your mind? Or is it the actual computational complexity?
[ Parent
| on HN ]
Re:If Not React, Then What?
by teddarific on Saturday November 30, 2024 @06:49PM
(#42284936)
Am curious on the O(n) calculation as well haha — I get what OP is saying, but would love to know if there's some deeper technical details here.
The basic idea is if you have n ways your page can display, with the old PHP/CGI whole page refresh model you needed to write n endpoints, but every interaction required a slow and disruptive whole page refresh
With pre-react single page apps, if you had O(n) ways your webpage could display, you needed to write code to account for n^2 ways that each of those n states could transition into another one of those n states
With react, you write code to render n pages, and get the fine grained interactivity for free with good (enough) performance. It basically removed a tradeoff/dilemma that had been facing web developers since time immemorial, so no surprise it was a big hit