Expert Review of React & LitElement 
Tags: computerscience, notcomputerscience
Published: 2021-02-11 07:03:46

Ha, that was click bait, I don't understand any of this. I have one semester of Java under my belt, that's it. Let us dive in and dissect whatever React & LitElement are. 

I can say with 99% confidence that these both involve Javascript. I can also responsibly speculate that they are both open source. From what I have read/watched it appears that they both are ?good? for creating web components. I have played around with both React & LitElement. ~~I didn't have fun, so it wasn't really playing.~~ Let's see how poorly I understand these. 

As someone with an absolute basic understanding of coding, I found the tutorial for LitElement to be more beneficial for me. I was overwhelmed with the react tutorial. React jumps right in with making a god damn tic tac toe game, that's next level gaming/coding that I wasn't ready for. While, yes I am sure the basics got covered with the React tutorial, I liked that LitElement just showed me the basics, without anything too advanced like tic tac toe. I still felt like an idiot reading both pages, but we fully embrace that and move on.

From what I can tell, it seems like you need React to develop web components. React utilizes virtualDOM. The virtual DOM (VDOM) is a programming concept where an ideal, or “virtual”, representation of a UI is kept in memory and synced with the “real” DOM by a library such as ReactDOM. This process is called reconciliation." [check that out here](https://reactjs.org/docs/faq-internals.html) The virtual DOM eliminates the need to manually update the DOM when you are building something. Also, the virtualDOM is not the shadowDOM. The shadowDOM is not the [shadow realm](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwjG-fa3k-HuAhXDWc0KHTxgCpkQFjACegQIBxAC&url=https%3A%2F%2Fevil.fandom.com%2Fwiki%2FShadow_Realm_(Yu-Gi-Oh!)&usg=AOvVaw2Q9IBJq46xGRejzxLVdfl6) from Yu-Gi-Oh! React says that, "The Shadow DOM is a browser technology designed primarily for scoping variables and CSS in web components. The virtual DOM is a concept implemented by libraries in JavaScript on top of browser APIs." I would say React is good for building and LitElement is good for designing. LitElement, which is a part of Polymer, which is a Javascript library, is being used for resigning Youtube, Google, and Google Earth. Pretty much anything Google owns has elements of Polymer in it, so check your DNA.

Another difference is that React has a framework, while LitElement has a library. I am a little confused by this. If you go on React's [website](https://reactjs.org) they have a huge banner that has "Javascript library" in it. This [website](https://www.oreilly.com/library/view/what-react-is/9781491996744/ch01.html) says React is a library not a Framework. However, Jermel on [quora.com](https://www.quora.com/Is-React-a-library-or-a-framework-and-why) (who has 15+ years of software development) says that evidence points to it clearly being a framework. Thankfully, I couldn't find any disputes that LitElement was a library. Frameworks and libraries are both reusable code that you can use. They can help you solve problems, and it looks like they can keep your code cleaner and more organized. 

There are some differences between a framework and a library. ~~One has books that no one reads.~~ A library looks like its much more fluid. You have more choices. A framework is much more ridged and doesn't allow for as much user control. There is a term called "inversion of control" You are in charge of how the application flows with a library, but the framework is in control of the flow. Check out more of this [here](https://www.freecodecamp.org/news/the-difference-between-a-framework-and-a-library-bd133054023f/). There is a good analogy that a library is building your own house at Ikea, you pick everything. A framework is like a contractor and blue prints building your house, much less control. ![image](https://dev-to-uploads.s3.amazonaws.com/i/uvi598x0ccalvcr13xx7.png)
 

Obviously, the level of control you have is going to be important to what you can do. It is a good idea to know if a library or framework will better suit your project.

I found a speed test online, which shows LitElement was 30% faster than React. I read the [article](https://labs.thisdot.co/blog/showcase-react-vs-lit-element-rendering-performance) and did not fully understand what and how they were testing, but hey 30% is a decent margin of victory, congrats LitElement.

If you would like to watch me talk about this [click](https://youtu.be/BZOYPzgt8GE) <-there