BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

React 15.5 Prepares Developers for Big Changes

| by David Iffland on Apr 14, 2017. Estimated reading time: 1 minute |

Facebook has released React 15.5 to give developers adequate time to adjust to a big change in 16.

In a blog post, Andrew Clark laid out the news that two features, React.PropTypes and React.createClass are being deprecated from the main package. To prepare for version 16, they have been moved into their own packages as a way to improve the code size going forward.

For now, developers will see a warning in the console if they use either of these features from the main package. If a developer doesn't fix it now, their code will break in version 16.

When React was initially released, there was no idiomatic way to create classes in JavaScript, so we provided our own: React.createClass.

Later, classes were added to the language as part of ES2015, so we added the ability to create React components using JavaScript classes. Along with functional components, JavaScript classes are now the preferred way to create components in React.

If recoding an app to use JavaScript classes is not an option, developers can also choose to switch to the create-react-class module available on NPM. This will still require changes to the code, but avoids using JavaScript classes.

The removal of propTypes shouldn't be too big of a loss for most developers. Those that code React in TypeScript or that incorporate Flow into their tool chain have had better ways of type checking React projects. For example, a TypeScript developer might define their props with a strong type:

interface MyProps { firstName: string, lastName: string }

export default class MyComponent extends React.Component<MyProps, any> {

}

Declaring a class in this way would automatically give a TypeScript developer proper type checking. The use of propTypes would already be redundant.

Version 15.5 is also the last release of the React addons. While some of them have been pushed to other packages, createFragment has been incorporated into version 16 which has support for fragments built-in.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date with curated articles from top InfoQ editors

"You dont know what you dont know" change that by browsing what our editors pick for you.

BT