React.js gets a Fresh Update


With Facebook’s founder testifying to the U.S. Congress, in unrelated news, the company’s React.js UI library for JavaScript recently received a new update. Version 16.3 of React provides a host of new features for developers hoping to add some efficiency to their web applications. If you are interested in downloading it, the update is available on Facebook’s own GitHub repository.

If your team isn’t using React, check out our previous articles covering it and its mobile variant, React Native. What follows is a high level overview of React version 16.3. News about the new update appeared in InfoWorld, among other sources.

A Look at the New Features of React.js 16.3

The main changes in the updated version of React involve improved management of the component lifecycle, as well as a new API to help developers better deal with context in their application. These new component lifecycles include: getDerivedStateFromProps and componentWillReceiveProps, which gives programmers a safer option than using the legacy versions. Another one, getSnapshotBeforeUpdate, safely handles the reading of properties before performing an update.

Some lifecycles are receiving an “unsafe” prefix to warn developers not to use them. Runtime safety isn’t the issue as much as the likelihood of deprecated functionality and subsequent incompatibility with future versions of React. In short, they are warning you about potential future bugs. Another reason for this is providing a “heads up” to engineers maintaining open source applications using React.

Facebook engineer, Brian Vaughan commented on what led to this new lifecycle functionality. “A few days ago, we wrote a post about upcoming changes to our legacy lifecycle methods, including gradual migration strategies. In React 16.3.0, we are adding a few new lifecycle methods to assist with that migration,” said Vaughan.

Another option involves using the new StrictMode component. This serves to identify any unsafe legacy lifecycles when running in development mode. It also warns about other side effects from using older lifecycles and React functionality. Expect additional features to be added to this component in future updates.

The New React Context API adds Efficiency

In addition to providing a boost in efficiency, React’s new Context API allows for static type checking and deep updates. Data is able to be passed through a component tree without the manual inclusion of props. The old API is expected to still work for a few more versions, so start updating your code to use to new one.

Facebook cautions about overusing the new API. “Don’t use context just to avoid passing props a few levels down. Stick to cases where the same data needs to be accessed in many components at multiple levels,” said the social network’s development team.

Other fresh features in React 16.3 include a new API for managing refs, called createrefAPI. This lets programmers access DOM nodes or React elements derived from the render process. The forwardRef API facilitates code reuse by help devs use higher-order components for this purpose.

Since React is effectively becoming a standard for UI development in web applications, we hope this look at its latest version provides some insights for you and your team. As always, thanks for reading the Betica Blog. We hope to see you again very soon!

GitHub Analysis reveals the Changing Face of Programming Language Usage

One obvious constant in the technology industry is its rapid pace of change, and the practice of programming offers no exception to this rule. What was once a popular language at the turn of the century might hardly get used for applications today. On the other hard, new programming languages seem to appear on a monthly basis.

Data from the source code repository, GitHub, offers a window on this changing face of software development. Let’s look more closely at their analysis to check the latest trends in programming language usage. Perhaps these insights might be of use in your own team’s development efforts?

393 Different Programming Languages at GitHub – in One Year!

GitHub boasts 4.5 million users who maintain around 10 TB of source code at the repository. Incredibly, those development projects are written in 393 different programming languages. Even more impressive is that data only represents one year of GitHub usage statistics!

Those numbers have only increased since the original July publication of an article by Waren Long at the source{d} blog used as a reference for this post. Another interesting point is their analysis doesn’t even include JavaScript, one of the most widely used languages, because of GitHub users’ propensity to refer to popular libraries, like Node.js or React.js, as a project’s language instead of JavaScript.

Long’s methodology for determining programming language is quite detailed, so refer to the link in the previous paragraph for additional insights, if interested. 

The Current Most Popular Programming Languages on GitHub

There are few surprises listed among the most popular languages currently in use at GitHub. Python and Java rank at the top of the list, with a popularity percentage of 16 and 15.3 respectively. That doesn’t necessarily mean both languages have more lines of source code stored in the repository. That honor lies with PHP, even though it only ranks at #5 on the popularity scale.

Other languages in the top 10 include the venerable, like C, C++, and C#, along with relative upstarts like Ruby, Objective-C, and Go. Apple’s newer programming language for iOS applications, Swift, rounds out the top 10. A related analysis adding in Google search queries to the GitHub data notes that Go is currently the “hottest” programming language.

Moving from One Language to Another

The original source{d} blog article also looked what languages programmers are transitioning into over time. This is useful information for both individual developers as well as software development shops. For example, many Visual Basic developers eventually transition into C#, which isn’t surprising for programmers working primarily on the Microsoft technology stack.

PHP developers, on the other hand, tend to move into Java, Python, or even C#. Python’s current popularity is confirmed by the fact that 24 percent of programmers working in the five other most popular languages — Java, C, C++, PHP, and Ruby – eventually work with Python. The “walled garden” nature of Apple platforms is revealed by the high percentage of programmers switching between Swift and Objective-C for project work.

Ultimately, anyone working as a programmer or a manager of software development needs to dive into the source{d} analysis of GitHub’s data. It’s truly fascinating.

Keep coming back to the Betica Blog for additional insights from the software development world. Thanks for reading!    

An Overview of React.js

React – better known as React.js – is a JavaScript library used in many modern web applications. It facilitates the building of responsive user interfaces, able to perform well in highly scalable environments. The library’s functionality combined with its relative ease of use has led to a massive growth in popularity among developers over the last few years.

We’re going to provide a high-level overview of React.js to see if it makes sense on your own company’s web development projects. Expect additional articles on the topic in the future, including a look at React for mobile – React Native.

A Short History of React.js

Jordan Walke, an engineer at Facebook, first developed the React framework in 2011. After getting used on the social network’s news feed, the company then implemented it on its Instagram network the following year. The framework became open source in 2013 at JSConf US, a JavaScript user conference.

The previously mentioned React Native first became available in 2015. In addition to supporting the Android and iOS mobile platforms, this framework also works with Microsoft’s Universal Windows Platform (UWP).

Earlier this year, Facebook announced plans to re-architect React into a new framework, known as React Fiber. While currently used in places on the social network, Fiber is expected to be publicly available by the end of the year. It promises a performance boost in addition to backwards compatibility.

A Closer Look at React.js’s Major Features

The original need for React.js involved creating a library suitable for responsive, data-driven web applications that are highly scalable. Considering the massive user base and resultant throughput of Facebook, it makes sense React saw its genesis at that social network.

The framework lets developers create component-based structures able to manage their own state. When combined with the virtual DOM (the HTML Document Object Model) and support for one-way dataflow, this makes it easier to build data-driven user interfaces for a scalable environment. React is able to seamlessly manage the user interface; only rendering those components with changed data.

React is essentially agnostic when it comes to an application’s chosen technology stack. This facilitates using the framework in one small part of an existing web application without affecting the rest of its architecture. If your organization is curious about React.js, taking this approach is a great way to learn the library before implementing it across the entire application.

JSX, a markup language somewhat similar to XML or HTML, is the primary means for defining user interface components in React.js. Since it is optional, programmers can still use raw JavaScript to achieve the same result, but JSX code is more concise and readable. It is also easy to access the component’s state and thus rendering its display whenever this underlying state changes.

While this overview only scratches the surface of what’s possible with React.js, leverage these insights to better determine whether the framework makes sense as part of your organization’s web development toolbox. If you are in the business of building extremely responsive web apps that are highly scalable, React probably belongs in your stack.

Thanks for checking out the Betica Blog. Keep coming back for additional news, stories, and insights from the wide world of software development!