Hi everyone, I’ve been studying react lately and it’s confusing, amazing, difficult and intriguing… somewhere between AWESOME and “what in the world is going on” with “states”???
Anyway, I thought I’d start a topic on when to USE and when NOT to use REACT.
This is more of a question for me and it started when I read this article:
I’ve also been reading/watching and learning modular programming and javascript modules using DOM caching, event binding etc… javascript prototype models…
So far from my limited understanding… what react has effectively done is:
- instead of DOM caching in modular javascript… it has created a “virtual dom” that lives in javsScript instead of on html since the “DOM is REALLY SLOW”… and from here with some js wizardry… it can compare changes in the “Virtual DOM” so it only “renders” what needs to be rendered in the actual DOM…
best case scenario of this feat would be this you tube video I found where they rendered over 500,000 <li></li>
elements
- TO CREATE new COMPONENTS:
REACT is basically using an Object.create feature of the prototype model of javaScript modular programming… so the parent-child flow of information is a flow of this prototype model using Object.create… and then it just assigns each new module to a new div id…
Now when not to use REACT?
I found this article:
https://objectpartners.com/2015/11/19/comparing-react-js-performance-vs-native-dom/
so It seems that REACT.js has some performance costs?
I really like learning react… and I guess learning react with basic small components (which could otherwise be rendered more easily with simple vanilla HTML) is the best way to do that…
However, in production… what are the use case and non-use case scenarios for this awesome feature? when is it a great tool and when am I just using the latest Buzz word/framework in the javaScript world (but actually overburdening my code)?
Another problem I’m seeing with react is “encapsulation”. It’s great since (CSS) does not leak all over the place until I wonder about WHOLE PAGE/WEB lay out changes which could easily be fixed by a simple SASS update… from what I’ve read… REACT likes all its styleing inline (kinda like email templates?)…so how about css animations? that already work natively with the DOM?
My current idea I guess is…
-
for simple one page apps:
regular js with modular js patterns? modular, prototype? maybe pubsub methods?
we probably don’t need react if you’re just gonna render 50,000 things as shown in the early video… -
for large complex apps… I guess that’s when react comes in but when exactly?
Maybe those with more experience can put some insight as to when REACT is NOT the best approach?
Still liking REACT though… just don’t want to end up using it for the sake of using it…
Thanks again!