What is React?
Well, why should we care about react? I personally think React is a great tool. On the website itself it shows how components and states work. To save you a few clicks I will be using the examples from reactjs.org to help explain whats going on and complete the code here.
Let’s break this down. We have a class here called HelloMessage that extends to a component through React, we then render and return some HTML. Afterwards we go to our DOM and render that HTML but we choose what name we would like to render, in this case it’s “Taylor”, then we grab the id of a div within our HTML and have it printed. The result will be “Hello Taylor.”
We can change “Taylor” to anything within our “HelloMessage” inside the DOM. Think about React as a library, we create multiple components and we can use them anywhere as long as we import them into other files, but we must also export our class as well. That’s something I will go into more detail in a later date. This was a tiny example, I hosted an example in a different blog on how it works in my Sneakers blog. I truly think that learning React is very important; They stated on their website “Learn Once, Write Anywhere” which is true. It’s an incredible tool and I hope everyone starts using it as much as possible for bigger projects.
This was a fun sized blog on my interpretation of React. I hope you enjoyed it and keep coding on! Thank you so much for reading.