Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible use this library with ES6 Imports? #19

Closed
Jenan opened this issue May 17, 2017 · 2 comments
Closed

Possible use this library with ES6 Imports? #19

Jenan opened this issue May 17, 2017 · 2 comments

Comments

@Jenan
Copy link

Jenan commented May 17, 2017

Hello,

is it possible use this library with ES6 Imports?

I have tried something like this:

import { reactStringReplace} from "react-string-replace";
But it doesn't work because I get error reactStringReplace is not a function

How can I fix this? :)
Thank you.

@iansinnott
Copy link
Owner

Yup, that should work fine, but the function is the default export not a named export. So try:

import reactStringReplace from "react-string-replace";

@iansinnott
Copy link
Owner

Check out this example for a working example: https://github.com/iansinnott/react-string-replace/blob/master/example/index.js#L3

Note that this module is NOT written in ES6, but if you are using bundler like Webpack it should still be able to handle it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants