Giter VIP home page Giter VIP logo

Comments (7)

Wayne-Ehr-Surprenant avatar Wayne-Ehr-Surprenant commented on June 30, 2024 2

I had the same issue. I just used
import Linkify from 'react-linkify';

instead of
var Linkify = require('react-linkify');
and now it works!

from react-linkify.

maksis avatar maksis commented on June 30, 2024 1

@cebrakadabra what was the exact issue with the code that you solved?

The current release should work fine when using ES6 imports:

import Linkify from 'react-linkify'

Or with CommonJS:

var Linkify = require('react-linkify').default;

That behavior is caused by Babel 6 upgrade in commit 6ead6fe which changes the way how export default works

@tasti the usage example in README is currently broken

from react-linkify.

katpas avatar katpas commented on June 30, 2024

Is there a fix or explanation for this one? I've had to use a different module as getting the same error.

from react-linkify.

triple1c86 avatar triple1c86 commented on June 30, 2024

yea same problem..

from react-linkify.

cebrakadabra avatar cebrakadabra commented on June 30, 2024

Yo!

I just did a PR for this.
i recoded the component to make it working in higher react versions.
I just imported that file via, to test it:

import Linkify from 'Linkify.jsx';

https://github.com/tasti/react-linkify/pull/35/files

from react-linkify.

cebrakadabra avatar cebrakadabra commented on June 30, 2024

@maksis i restructured the whole Linkify component itself to make an element out of it. Because you aren't accessing any functions from outside and you are not reliable on the state of this one, so I thought it's probably easier doing it that way.

i got the same error as reported from other people here:
React.createElement: type is invalid -- expected a string (for built-in components)

So, I used that as a motivation to make an Element out of it while debugging the error, which was probably just a wrong usage of import { Linkify } from ... instead of import Linkify from ... on my end. Basically that's what the error describes.

Furthermore: https://facebook.github.io/react/blog/2015/12/18/react-components-elements-and-instances.html

Out of the react docs:

An element is a plain object describing a component instance or DOM node and its desired properties. It contains only information about the component type (for example, a Button), its properties (for example, its color), and any child elements inside it.

An element is not an actual instance. Rather, it is a way to tell React what you want to see on the screen. You canโ€™t call any methods on the element. Itโ€™s just an immutable description object with two fields: type: (string | ReactClass) and props: Object1.

from react-linkify.

tasti avatar tasti commented on June 30, 2024

This looks like an importing issue as described and solved by @maksis. I'll update the README.

from react-linkify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.