danawoodman / react-fontawesome

A React Font Awesome component.
https://www.npmjs.com/package/react-fontawesome
MIT License
667 stars 72 forks source link

React v15.5.0 createClass warning. #45

Closed gabrielrtakeda closed 7 years ago

gabrielrtakeda commented 7 years ago

Description

When running my personal project, this warning is dispatching:

Warning: FontAwesome: React.createClass is deprecated and will be removed in version 16. Use plain JavaScript classes instead. If you're not yet ready to migrate, create-react-class is available on npm as a drop-in replacement.

I am googled a bit and I found the React v15.5.0 blog post.

Basically, is need to make this:

-import React, { Component, PropTypes } from 'react'
+import PropTypes from 'prop-types';
+import React, { Component } from 'react';

It has the React-PropTypes-to-prop-types codemods but, it seems that does not migrate the PropTypes of stateless components.

To install the codemods, follow the following steps:

  1. npm install -g jscodeshift
  2. git clone https://github.com/reactjs/react-codemod.git (inside the root of the project)
  3. cd react-codemod && npm install

To run the migration is:

danawoodman commented 7 years ago

What version of react-fontawesome are you using?

danawoodman commented 7 years ago

If you are not on v1.6.0 or above, please upgrade as that issue should have been fixed already.

gabrielrtakeda commented 7 years ago

Hi, @danawoodman I am using the v1.5.0, thanks for the quick reply and, sorry for the inconvenience.

danawoodman commented 7 years ago

No worries, glad you sorted it out!