關於網路那些事...

網路行銷,SEO,網路趨勢,教學文章,網頁設計,生活時事

2015 值得關注的3個 Javascript 庫

作為一個工程師,我們了解這行業的步調演變得非常快,超快。事實上,我們未必能夠即時跟上這些新的程式庫、框架及目前所使用工具的最新版本。但是,仍然必須保持動力,確保能夠繼續的產出,以符合老闆及客戶的期望。

新的一年已經度過了兩個多月,一些新趨勢也已經開始形成初期的規模。在本文中,將介紹三個值得在2015年關注的程式庫即框架。

React.js


React.js,也可簡稱為 React,主要用於開發使用者介面。由 Facebook 及 Instagram 聯手打造出來。目前,由這兩家公司進行維護,使用者群包含有 Yahoo, Airbnb, Sony, Facebook及Instagram。

React.js並不是一個完整的框架,因此會找不到一些存在 EmberAngular JS的功能。他所倡導的精神主要在產生可以重複使用的UI元件,可以根據時間來調用數據。也因為這樣,很多人都習慣將它是為MVC中的V。並且和Angular JS最大的不同處在於: Angular JS是使用雙向數據綁定,而React是偏向於單向數據綁定模式

最重要的是,這個專案是以類似DOM的概念。 你可以用來設定元素,控制數據,以及調整頁面中的DOM。
You can think of it as a set of elements that you can modify with your data and which, in the end, will modify the page’s real DOM. The virtual DOM is used for efficient re-rendering of the DOM by using a diff algorithm that only re-renders the components changed. This in turn enables the library to be ultra fast.

Another great feature is that it can also render on the server using Node.js. Therefore, you can use the same knowledge you’ve gained both on the client and on the server. This has major performance and SEO benefits. Many developers are using React.js to render a first, static version of the page on the server, which is faster than doing so on the client and is also SEO-friendly. Then they enable fast user interactions and UI updates by using React.js on the client side.

This is just a brief introduction to this library, and I really encourage you to learn more by visiting the React.js website. It contains a lot of useful tutorials that will help you in the learning process.

Meteor

Meteor is an open-source JavaScript framework written on top of Node.js, that focuses on real-time web applications. It’s not very new, as it has already reached a stable version (1.0), but lately I’ve been seeing more and more people discussing and adopting it to create their applications.

One of the main pros of Meteor is that it brings the famous Java motto of “Write once, run everywhere” into the JavaScript world. Using Meteor, you write code that runs both on the client and on the server, and you can even turn your web app into a mobile application by using Cordova behind the scenes. This kind of application is referred to as an isomorphic application – meaning an application that can run both client-side and server-side. The backend and frontend share the same code. If you love the fact that you can turn a Meteor application into a mobile app, you may want to read the article A Beginners Guide to Mobile Development with Meteor by David Turnbull.

When you install the framework, you get everything you need to develop both the client and server sides of your application, so it’s really fast to get up and running. Meteor comes with its own CLI that allows you to speed up your workflow. It also allows you to create a demo application on your local machine by typing the following command:

meteor create --example todos

One of my favorite features of this framework is that it’s reactive, meaning that any change to your data is automatically reflected everywhere throughout the app without the need for callbacks. Besides, as I mentioned before, Meteor focuses on real-time applications. So changes made by you or by other users are instantly reflected in the UI.

If this introduction seems appealing to you, I suggest to visit the official Meteor website, or read the articles 7 Reasons to Develop Your Next Web App with Meteor and What You Need To Know About Meteor 1.0, both published here on SitePoint.

Rendr

In recent months, I’ve been reading a lot about isomorphic applications, and Rendr is another library that employs this concept. It’s a small library developed by Airbnb that allows you to run Backbone.js applications on both the client and the server. The advantages are the same as mentioned in the React.js section: serving static and SEO-friendly HTML pages fast.

Being light-weight is one of the goals of this project. As mentioned in this article:

In true Backbone style, Rendr strives to be a library as opposed to a framework.

Rendr also tries to be agnostic about the environment by minimizing code like if (server) {…} else {…}, which is what you’ll find in frameworks like Meteor.

Unfortunately, I’m not aware of real-world applications built using this framework (apart from the one mentioned in the linked Airbnb post), so I’m not sure it’s mature enough to be used in production.

Conclusion

In this article, I’ve described three very interesting projects that are attracting a lot of attention and that are joining the fascinating trend towards isomorphic applications.

In recent weeks I’ve been playing with React.js, and I must confess that I’m loving it. I’m still in the process of learning this library, so I don’t have strong opinions on it yet, and I need to use it in a major project to test it properly. But if it can serve the Instagram user base, I’m sure it can perform reliably in small to medium applications. I do find it funny that, while Google isn’t using its own AngularJS for applications like Gmail, Facebook is adopting React in production.

Have you ever used one or more of these libraries and frameworks? If so, what was your experience with them? And if you haven’t used them, are you willing to give them a try?

原文:3 JavaScript Libraries to Keep an Eye on in 2015


如果這篇文章對你有幫助,請在這裡點個讚



最新文章推薦