A: 617. Merge Two Binary Trees
The algorithm foundation is relatively weak, it took many attempts to pass~
R: Things you forgot (or never knew) because of React
- React, due to its early release, has gained a certain advantage and become the standard. However, it also has some serious drawbacks in terms of agility and adaptability. Since 2013, every decision made by React has added another layer of technical debt, while its competitors do not have these limitations.
- Regarding the issue of the ecosystem: we have been "trained" to think that packages are specific to frameworks. React has accelerated this viewpoint, where we look for React packages for everything instead of native JS packages. As a result, React's rules, state management, component lifecycle, and other aspects are brought in, which may not work well or be convenient with incompatible frameworks. However, it shouldn't be like this. Everything is just JS, so anything related to JS should be included. (Of course, this is also true for frameworks like Svelte and Vue, but React is the heaviest in this regard. Other frameworks are more adaptable and do not have issues like rendering lifecycle. The common choice of these frameworks is to use web components). Preact's Signal is an example, although it is used for itself, it can also be used in any other framework or even native JS. The same goes for Web Components, which are compatible with any non-React framework.
- React Hooks are outdated: Hooks are no longer an advantage, they are the baseline and the conventional way. Other frameworks have similar things, but they are faster, easier to use, and write.
- You no longer need to manage rendering at a granular level: For example, the difference between
useMemo
anduseCallback
, understanding the dependencies ofuseEffect
and its lifecycle. You don't need to worry about these in other frameworks. They are smarter and only update values instead of continuously updating unnecessary things. - Handling large-scale complex applications is no longer a necessary focus: React is not the best, only, or even the first solution for front-end handling large-scale complex applications. It is just one of the many possible versions of the same paradigm, and it is an outdated version. Other modern competing frameworks can also handle this problem.
- Server-side rendering is no longer special: Besides React, most players also support server-side rendering.
- Two-way data binding is not difficult or bad: React has a unidirectional data flow, so using forms is cumbersome. Two-way data flow doesn't have these problems, and some of the problems caused by two-way data flow have also been solved through long-term iterations.
- Handling styles is simple: React does not have a built-in elegant solution for styles, but in Vue and Svelte, this problem has been solved internally. They both have component-level scope, and the solutions that can be used in React can also be compatible with them.
- Learning frameworks is no longer so difficult: React's state management, props, nesting, lifecycle, hooks, JSX, etc., are not user-friendly to learn. The new frameworks now are much easier to learn.
- The author highly recommends Svelte and Vue, two compile-time frameworks.
T: CodeBox
An isolated Python sandbox runtime environment that can be used to implement ChatGPT Code Interpreter.
S: Some memories of reading "The Highest Learning-to-Application Method"
It is best to control the ratio of output to input time at 70% to 30%. Output is the "effective" way of learning, having input without output is equivalent to not learning, and also not remembering.
Reference: