1

I am using react-share with react 15.6 version. and getting the following error

TypeError: react__WEBPACK_IMPORTED_MODULE_9___default.a.forwardRef is not a function

Here is my Code Snippet

import {WhatsappShareButton, WhatsappIcon} from 'react-share';

<WhatsappShareButton
  url={url}
  title={title}
  children={<WhatsappIcon
             size={32}
             round />} />

Any one who is using react share getting same error or anyone find the solution?

Linda Paiste
  • 38,446
  • 6
  • 64
  • 102
Pardeep Sharma
  • 301
  • 4
  • 14

1 Answers1

0

According to the README it should be compatible:

Compatibility

Version 1.x.x: compatible with React versions 0.13.x, 0.14.x and 15.x.x.

Version 2.x.x: compatiblity is tested with React 15 and 16.

Version 3.x.x: compatiblity is tested with React 15 and 16.

However, it is not uncommon in the npm universe that such incompatibilities occur, especially if you are not upgrading all your dependencies consistently.

In those cases you should however search for the existing GitHub issue or create one, instead of an SO question, because once they are resolved, they serve little purpose here:

Starting from version 3.0.1 this awesome library become incopatible with React v15.X because of using forwardRef in this commit: 3dc5b94

The solution you are looking for is to downgrade to react-share 3.0.0 until the issue is being resolved or upgrade to react 16.

Nappy
  • 3,016
  • 27
  • 39
  • I already follow same issue on github. The purpose of asking the question here that if anybody also getting same error and find the solution of this then ans my question. Btw Thanks for trying to help – Pardeep Sharma Sep 03 '19 at 12:17
  • Sorry I do not want to be rude, but If you already found the GitHub issue it makes even less sense to ask here whether you are the only one having this issue. – Nappy Sep 03 '19 at 12:45
  • Thanks for suggestion. I edit my question little-bit. – Pardeep Sharma Sep 03 '19 at 12:59