tasti / react-linkify

React component to parse links (urls, emails, etc.) in text into clickable links
http://tasti.github.io/react-linkify/
MIT License
555 stars 106 forks source link

Invariant Violation #86

Open jmkoomen opened 5 years ago

jmkoomen commented 5 years ago

I included Linkify according to the documentation:

import Linkify from 'react-linkify';

`render() { return ( ...

{some.text}
  ...

); }`

but when running my app I get:

invariant.js:44 Uncaught (in promise) Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in. Check the render method of 'Linkify'. at invariant (http://localhost:3020/static/js/bundle.js:11421:16) at ReactCompositeComponentWrapper.instantiateReactComponent [as _instantiateReactComponent] (http://localhost:3020/static/js/bundle.js:25798:24) at ReactCompositeComponentWrapper.performInitialMount (http://localhost:3020/static/js/bundle.js:26223:23) at ReactCompositeComponentWrapper.mountComponent (http://localhost:3020/static/js/bundle.js:26114:22) at Object.mountComponent (http://localhost:3020/static/js/bundle.js:18495:36) at ReactDOMComponent.mountChildren (http://localhost:3020/static/js/bundle.js:25232:45) at ReactDOMComponent._createInitialChildren (http://localhost:3020/static/js/bundle.js:22237:33) at ReactDOMComponent.mountComponent (http://localhost:3020/static/js/bundle.js:22056:13) at Object.mountComponent (http://localhost:3020/static/js/bundle.js:18495:36) at ReactCompositeComponentWrapper.performInitialMount (http://localhost:3020/static/js/bundle.js:26227:35)

I also tried importing like import {Linkify} from 'react-linkify'; as it seemed that sometimes this causes the invariant violation. But it did not fix the problem. What could I be doing wrong here? Any help is appreciated.

jadus commented 5 years ago

Hi, did you find any solution to this ? I'm facing the same problem

axelson commented 4 years ago

It looks like this is because the 1.0.0-alpha now requires react 16 and uses React.Fragment: https://github.com/tasti/react-linkify/blob/325cb5e43300d7ada5bdf8d2849783d98fcd3c2c/src/components/Linkify.jsx#L74