4 ms·
This too was my roadblock in the article > You’d be forgiven for thinking you were looking at a React component! Frankly, I don’t see a fundamental difference
by madeofpalk 2y ago
This too was my roadblock in the article
> You’d be forgiven for thinking you were looking at a React component! Frankly, I don’t see a fundamental difference between these and frameworks like Svelte or Vue
Regardless of whether you should be forgiven for thinking it’s a react component, it omits it’s biggest strength - JSX is just JavaScript function calls, and thus can be composed as JavaScript and type checked as java/typescript.
This to me is the fundamental difference between React/JSX and other approaches. Any framework that gives up on type checking for the view layer is a non-starter in my books.
- CharlieDigital 2y agoThe fundamental differences are quite stark. Vue, Svelte, web components, and vanilla only execute code that is marked as a callback. Example: let x = 0 var counter = computed(() => ... ) In this Vue snippet of an SFC, the callback in the computed executes in reaction to some change without invoking the assignment of x (obviously a trivial case here). DOM + JavaScript is the same React invokes the entire component function and all calls and allocations in the path of the component function. The mental model is inverted in a sense. This is one of the reasons React generally performs more poorly in both speed and space.