By Yeo Yong Kiat in ReactJS
Come join me in my journey to learn ReactJS. I'm not a professional web developer, but all the more I'm eager to demonstrate that it doesn't take a professional coder to master the fundamentals of ReactJS, or React for short. I hope to outline my journey in learning React, and may it be a learning resource for all who are keen. In this first article, I write generally about what React is all about, who should learn it, and why.
Before speaking about React, let's just harken back to the early 2000s. You see, in the past, the Internet was simple. Websites, webpages and web applications were all retrieved and rendered from the server. In those days, web interactions were all about the HTTP GET method. Let me explain.
You would be sitting in front of your computer, using a browser (in web dev speak, that's called a client). You would visit a URL, and what that means is that the browser would use the GET method to request for a HTML file and all of its associated CSS and JS files from a server (which is this crazy big computer backend that hosts all the files).
After waiting for a while, you would then see the HTML being rendered in your browser. The CSS file tells your browser how to design and style the page, and the JS file just has a bunch of coding statements that allows you to interact with the webpage (largely through IF and FOR loops, really).
Here's how the new web kind of works - you visit a webpage as before, but instead of requesting a comprehensive HTML file and all its associated CSS and JS files, you actually only request (in an ideal case), a very simple HTML file, and one JS file. The cool thing is that this JS file now works in your browser to render even more complicated HTML and CSS functions, and produces this really complex HTML to render in your browser.
A true SPA would then also make it such that whenever you move from page to page within the same website, you actually don't request for more files from the server! Your browser actually uses the initial JS file to render each new page.
You got it - it's as if entire web experience is being delivered through code. The server just dishes out JS files (well, and a bare bones HTML file of course), and these JS files are executed in your browser to generate the complex webpage you see.
This may sound like plain history, but it's one of the important reasons why people choose to learn React. You see, React was created by Jordan Walke, a software engineer at Facebook who open-sourced it in 2013. And, surprise surprise, while being open-source now, it's being maintained by Meta (formerly Facebook) and a community of individual developers and companies.
So React is naturally always kept up-to-date and relevant. In fact, React has a cousin called React Native, which allows you to create apps across android and iOS systems with React. The politics and entire community behind React is itself a good reason to pick up React - the community itself is a hotbed of innovation and discussion.
So why not just plain vanilla JS for creating your apps? Well, technically you could, and you should if the apps you're writing have such highly specialised UI requirements that require special handling through plain vanilla JS. But if I could sum it up, I think React provides the following for web developers:
Well, I'm no professional web developer, so anyone really with an interest really. But beyond coders, I think two groups of people might be interested in picking up React:
Well, let's hope I keep this learning up. Ta-ta for now, see you around.
I'm thinking an article on node and npm next would be useful. I did not know about these before I started.
Find more ReactJS stories on my blog. Have a suggestion? Contact me at [email protected].