What's New in React 16.9: The UNSAFE Update

Originally published by Austin Roy at https://scotch.io

As we prepare for React v17, the React core team continues to make incremental changes and recently released React 16.9.0. This release builds on previous versions with a number of deprecations, new features and bug fixes.

Table of Contents

  • Renaming Unsafe Lifecycle Methods
  • Deprecating JavaScript: URLs
  • Deprecating “Factory” Components
  • Async act() for Testing
  • Performance Measurements with
  • Notable Bugfixes
  • Conclusion

Renaming Unsafe Lifecycle Methods

One of the biggest driving forces behind React 17 is asynchronous rendering which aims to improve both the user and developer experience. To allow asynchronous rendering, there has to be a change in the component lifecycle and this involves deprecation of some lifecycle methods which were introduced without async rendering in mind.

One of the biggest driving forces behind React 17 is asynchronous rendering

To prepare for these deprecations these lifecycle methods will be renamed in React 16.0 as follows:

  • componentWillMount → UNSAFE_componentWillMount
  • componentWillReceiveProps → UNSAFE_componentWillReceiveProps
  • componentWillUpdate → UNSAFE_componentWillUpdate

Now your code will look like:

class App extends Component {
 UNSAFE_componentWillMount() {
   // ewwwww

This is a nudge to get all React devs to stop using these methods.

React 16.9 does not contain breaking changes, and the old names continue to work in this release. But you will now see a warning when using any of the old names. These warnings provide better alternatives to these lifecycle methods.

Easily Renaming UNSAFE Methods

To allow easy renaming for projects where one may not have adequate time to migrate to the recommended lifecycle methods, the React team recommended a script from codemod that automates this process.

cd your_project
npx react-codemod rename-unsafe-lifecycles

This will rename all the affected lifecycle methods to prepare for the migration to React 17.

Deprecating JavaScript: URLs

URLs starting with javascript: are a dangerous attack surface because it’s easy to accidentally include unsanitized output in a tag like <a href> and create a security vulnerabilities such as making the app more vulnerable to XSS attacks.

const userProfile = {
 website: "javascript: alert('you got hacked')",
// This will now warn:
<a href={userProfile.website}>Profile</a>

In React 16.9, this pattern continues to work, but it will log a warning. If you use javascript: URLs for logic, try to use React event handlers instead. It is also important to note that in future releases, javascript: urls will throw an error in React.

Deprecating “Factory” Components

Introduced prior to ES6 classes with Babel, React’s "factory” component returned an object with a render method as shown below.

function FactoryComponent() {
 return { render() { return <div />; } }

Despite not being the same as a regular functional component, this method looks very similar and may cause some confusion. It is also slightly slower and larger than necessary while also being very rarely used by developers. As a result it will be deprecated in React 16.9 and warnings will show up wherever this pattern is used.

If you rely on it, adding FactoryComponent.prototype = React.Component.prototype can serve as a workaround. However, it is advisable it to either a class or a function component as they are more efficient.

Async act() for Testing

Introduced in React 16.8, [act()](https://reactjs.org/docs/test-utils.html#act) is a testing utility to help you write tests that better match the browser behaviour. However, act() didn’t initially support asynchronous functions in React 16.8.

As of React 16.9 , act may now be used with async functions in the following format:

await act(async () => {
 // ...

This solves the remaining cases where you couldn’t use act() before, such as when the state update was inside an asynchronous function. As a result, you should be able to fix all the remaining act() warnings in your tests now.

For more information about testing patterns with act() you can check out the testing recipes.

Performance Measurements with

The React profiler for devtools was introduced in React 16.5 to enable measurement of the performance of React Components in order to allow developers to pinpoint areas where their applications can be better optimised.

In React 16.9 a more programmatic method of measuring performance through the <React.Profiler /> component.

The <Profiler> measures the frequency at which a React application renders and what the cost of each render is. Its helps identify parts of an application that are slow and may benefit from optimizations like memoization. It can be added anywhere in a React component tree to measure the cost of rendering that part of the tree.

It requires two props: an id (string) that identifies which part of the tree you are measuring incase you are using multiple profilers and an onRender callback which React calls any time a component within the tree “commits” an update as shown, this callback aggregates render cost.

 <Profiler id="application" onRender={onRenderCallback}>
     <Navigation {...props} />
     <Main {...props} />

It is important to note the that the Profiler adds some overhead and should be disabled for the production build of the application.

Notable Bugfixes

This release contains a few other notable improvements fixing a number of known issues from the previous releases:

  • A crash when calling findDOMNode() inside a <Suspense> tree has been fixed.
  • A memory leak caused by retaining deleted subtrees has been fixed too.
  • An infinite loop caused by setState in useEffect now logs an error. (This is similar to the error you see when you call setState in componentDidUpdate in a class that may cause a component to keep re-rendering.)


React has a very exciting roadmap as it continues to grow and improve with both users and developers in mind. Asynchronous rendering is a big deal as it will greatly improves the React experience for everyone involved by creating an environment where fast and responsive applications can easily be built.

 Thanks for reading

If you liked this post, share it with all of your programming buddies!

Follow us on Facebook | Twitter

Further reading about React

React - The Complete Guide (incl Hooks, React Router, Redux)

Modern React with Redux [2019 Update]

Best 50 React Interview Questions for Frontend Developers in 2019

JavaScript Basics Before You Learn React

Microfrontends — Connecting JavaScript frameworks together (React, Angular, Vue etc)

Reactjs vs. Angularjs — Which Is Best For Web Development

React + TypeScript : Why and How

How To Write Better Code in React

#reactjs #javascript #web-development

What is GEEK

Buddha Community

What's New in React 16.9: The UNSAFE Update
Autumn  Blick

Autumn Blick


How native is React Native? | React Native vs Native App Development

If you are undertaking a mobile app development for your start-up or enterprise, you are likely wondering whether to use React Native. As a popular development framework, React Native helps you to develop near-native mobile apps. However, you are probably also wondering how close you can get to a native app by using React Native. How native is React Native?

In the article, we discuss the similarities between native mobile development and development using React Native. We also touch upon where they differ and how to bridge the gaps. Read on.

A brief introduction to React Native

Let’s briefly set the context first. We will briefly touch upon what React Native is and how it differs from earlier hybrid frameworks.

React Native is a popular JavaScript framework that Facebook has created. You can use this open-source framework to code natively rendering Android and iOS mobile apps. You can use it to develop web apps too.

Facebook has developed React Native based on React, its JavaScript library. The first release of React Native came in March 2015. At the time of writing this article, the latest stable release of React Native is 0.62.0, and it was released in March 2020.

Although relatively new, React Native has acquired a high degree of popularity. The “Stack Overflow Developer Survey 2019” report identifies it as the 8th most loved framework. Facebook, Walmart, and Bloomberg are some of the top companies that use React Native.

The popularity of React Native comes from its advantages. Some of its advantages are as follows:

  • Performance: It delivers optimal performance.
  • Cross-platform development: You can develop both Android and iOS apps with it. The reuse of code expedites development and reduces costs.
  • UI design: React Native enables you to design simple and responsive UI for your mobile app.
  • 3rd party plugins: This framework supports 3rd party plugins.
  • Developer community: A vibrant community of developers support React Native.

Why React Native is fundamentally different from earlier hybrid frameworks

Are you wondering whether React Native is just another of those hybrid frameworks like Ionic or Cordova? It’s not! React Native is fundamentally different from these earlier hybrid frameworks.

React Native is very close to native. Consider the following aspects as described on the React Native website:

  • Access to many native platforms features: The primitives of React Native render to native platform UI. This means that your React Native app will use many native platform APIs as native apps would do.
  • Near-native user experience: React Native provides several native components, and these are platform agnostic.
  • The ease of accessing native APIs: React Native uses a declarative UI paradigm. This enables React Native to interact easily with native platform APIs since React Native wraps existing native code.

Due to these factors, React Native offers many more advantages compared to those earlier hybrid frameworks. We now review them.

#android app #frontend #ios app #mobile app development #benefits of react native #is react native good for mobile app development #native vs #pros and cons of react native #react mobile development #react native development #react native experience #react native framework #react native ios vs android #react native pros and cons #react native vs android #react native vs native #react native vs native performance #react vs native #why react native #why use react native

Which is the best React Native app development company in New York?

React Native, an open-source JavaScript mobile app dynamic framework that provides the opportunity for Android and iOS users to download and use your product.

In this digital era, all users require prompt information and most of the businesses want to give a better mobile app experience to their users. There are multiple mobile app development frameworks available and React Native is the best one of that.

Advantages of React Native Mobile App Development:

  • A mobile app can be developed with the help of Web technology which enables any web developer to easily enhance their skills and create React apps.
  • React Native supports in building cross-platform mobile apps.
  • It saves time and cost to develop mobile apps on many platforms.
  • Building blocks that are used in iOS and Android apps are also used while building React Native based apps which means that React Native is a mobile framework that compiles app components for native mobile applications in JavaScript.
  • A React Native app ensures speed and agility for the mobile apps with responsiveness and a great native app-based user experience.

Best React Native App Development Company in New York:

AppClues Infotech is the Best React Native Mobile App Development Company in New York that focus on delivering a feature-rich mobile app. Since established in 2014, they have successfully delivered 750+ mobile app development projects to their esteemed clients. They are developing a robust and high-quality mobile app using the latest methodology.

They have the best dedicated React native mobile app developers team who has high experience and the greatest strength of developing any types of React Native App Development. They are the one-stop solution for your any type of React Native App project.

React Native App Development Services by AppClues Infotech

  • Cross-Platform Development
  • MVP
  • Server-Side APIs
  • App Integration
  • User Preferences
  • Reusable Components

Easy Steps for Hiring Dedicated React Native App Developers from AppClues Infotech:

  1. Post Your Project Requirements

  2. Discuss Project Details

  3. Choose The Right Developers

  4. Get Started

Why Choose AppClues Infotech for React Native App Development?

  • Best Designer & Developers Team
  • Quality Assurance
  • Client Satisfaction
  • On-Time Delivery
  • Multiple Service at 0ne-Stop
  • Support & Maintenance
  • Competitive Price

Businesses have started considering React Native development for developing cross-platform mobile apps, as the platform offers many advantages which also include considerable cost and time savings. Additionally, it is an Open Source platform that also allows the integration of third-party plugins. I found this company based on so many hard research like top websites like IT Firms, Good Firms, Clutch, Glassdoor & many more. This company provides an excellent solution for the React Native app development. I hope this company extremely helpful for your future dream mobile app projects.

Discuss your app idea with AppClues Infotech Team or get a free quote from them.

#react native app development new york #react native mobile app development new york #top react native app development company new york #best react native app development services new york #custom react native app development company new york

Top React Native Mobile App Development Companies in USA

Are you looking for the Top React Native Mobile App Development Companies in USA? We at, AppClues Infotech is Leading React Native App Development Company in USA that builds an outstanding, creative & superior mobile app at an affordable price. Our React Native Experts provide you a complete solution and deliver you a high-quality react native app with the latest features.

Our React Native App Development Services:

• Cross-Platform Development
• Server-Side APIs
• App Integration
• User Preferences
• Reusable Components

For more info:
Call: +1-978-309-9910
Email: info@appcluesinfotech.com

#react native app development new york #react native mobile app development new york #top react native app development company new york #best react native app development services new york #custom react native app development company new york

React Native App Development Company in New York

#react native app development new york #react native mobile app development new york #top react native app development company new york #best react native app development services new york

React Native App Development Company in New York

AppClues Infotech is a pioneer when it comes to React Native App Development. The company offers innovative and robust React native apps that are rich-in-feature, incredibly fast, and scalable enough. AppClues Infotech focuses on making businesses quite flexible and enhancing their reach immensely in this competitive market.

AppClues Infotech is especially recognized for delivering industry-specific mobile apps within the agreed time-frame. The company has accomplished 750+ projects, regardless of business size.

It offers affordable react native app development serviceshttps://www.appcluesinfotech.com/top-react-native-mobile-app-development-companies-in-new-york/ that will suit your budget and enable you to hold the top position in this agile market with a dynamic, cross-platform mobile app.

The React Native App Development services offered by AppClues Infotech include:

Cross-platform development
MVP (Minimum Viable Product)
App integration
Reusable components
Server-side APIs
User preferences
Support and maintenance

#react native app development new york #React native Mobile app development New York #Top react native app development company New York #Best react native app development services New York